main.go 1.8 KB
Newer Older
C
cai.zhang 已提交
1 2 3 4 5 6 7 8 9 10 11
// Copyright (C) 2019-2020 Zilliz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License
// is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
// or implied. See the License for the specific language governing permissions and limitations under the License.

Y
yukun 已提交
12 13 14
package main

import (
15 16
	"os"

X
Xiangyu Wang 已提交
17 18 19
	"github.com/milvus-io/milvus/cmd/distributed/roles"
	"github.com/milvus-io/milvus/internal/log"
	"github.com/milvus-io/milvus/internal/logutil"
Y
yukun 已提交
20 21
)

G
groot 已提交
22 23 24 25 26 27 28 29 30 31 32
func initRoles(roles *roles.MilvusRoles) {
	roles.EnableMaster = true
	roles.EnableProxyService = true
	roles.EnableProxyNode = true
	roles.EnableQueryService = true
	roles.EnableQueryNode = true
	roles.EnableDataService = true
	roles.EnableDataNode = true
	roles.EnableIndexService = true
	roles.EnableIndexNode = true
	roles.EnableMsgStreamService = true
Y
yukun 已提交
33 34
}

X
Xiangyu Wang 已提交
35 36 37 38 39 40 41 42
func initLogCfg() log.Config {
	logCfg := log.Config{}
	logCfg.Format = "text"
	logCfg.Level = "debug"
	logCfg.Development = true
	logCfg.File.MaxSize = 300
	logCfg.File.MaxBackups = 20
	logCfg.File.MaxDays = 10
X
Xiangyu Wang 已提交
43 44

	// FIXME(wxyu): Load from config files
45 46 47 48 49 50 51
	logCfg.File.Filename = ""
	// ciFileDir := "/milvus/logs/"
	// if _, err := os.Stat(ciFileDir); err == nil {
	// 	logCfg.File.Filename = ciFileDir + "standalone.log"
	// } else {
	// 	logCfg.File.Filename = "/tmp/milvus/standalone.log"
	// }
X
Xiangyu Wang 已提交
52 53 54
	return logCfg
}

Y
yukun 已提交
55
func main() {
G
groot 已提交
56 57
	var roles roles.MilvusRoles
	initRoles(&roles)
58
	os.Setenv("QUERY_NODE_ID", "1")
59
	os.Setenv("DEPLOY_MODE", "STANDALONE")
X
Xiangyu Wang 已提交
60 61 62

	logCfg := initLogCfg()
	logutil.SetupLogger(&logCfg)
G
groot 已提交
63
	roles.Run(true)
Y
yukun 已提交
64
}