Commit 165d91d0 by 孙龙

up

parent f749294e
......@@ -17,6 +17,7 @@ type Config struct {
MongodbConnectTimeout int `json:"mongodbConnectTimeout"`
EtcdUserName string `json"etcdUserName"`
EtcdPasswd string `json"etcdPasswd"`
MondbDatabases string `json"mongodbDatabases"`
}
var (
......
......@@ -24,7 +24,8 @@ func InitLogMgr() (err error) {
// 建立mongodb连接
// 建立mongodb连接
clientOptions := options.Client().ApplyURI("mongodb://ichunt:huntmon6699@192.168.1.237:27017/ichunt?authMechanism=SCRAM-SHA-1")
clientOptions := options.Client().ApplyURI(G_config.MongodbUri)
if client, err = mongo.Connect(
context.TODO(),clientOptions); err != nil {
return
......@@ -32,7 +33,7 @@ func InitLogMgr() (err error) {
G_logMgr = &LogMgr{
client: client,
logCollection: client.Database("cron").Collection("log"),
logCollection: client.Database(G_config.MondbDatabases).Collection("log"),
}
return
}
......
......@@ -23,6 +23,11 @@
"mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000,
"etcdUserName":"root",
"etcdPasswd":"huntmon66499"
"etcdPasswd":"huntmon66499",
"mongodbDatabases": "ichunt"
}
\ No newline at end of file
......@@ -22,6 +22,13 @@
"mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000,
"etcdUserName":"",
"etcdPasswd":""
"etcdPasswd":"",
"mongodbDatabases": "ichunt"
}
\ No newline at end of file
......@@ -18,11 +18,14 @@
"webroot": "./webroot",
"mongodb地址": "采用mongodb URI",
"mongodbUri": "mongodb://ichunt:huntmon66499@172.18.137.23:27017/ichunt?authMechanism=SCRAM-SHA-1",
"mongodbUri": "mongodb://crons:ichuntcrons@172.18.137.23:27017/crons?authMechanism=SCRAM-SHA-1",
"mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000,
"etcdUserName":"root",
"etcdPasswd":"huntmon66499"
"etcdPasswd":"huntmon66499",
"mongodbDatabases": "crons"
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ type Config struct {
ExecCommand string `json"execCommand"`
EtcdUserName string `json"etcdUserName"`
EtcdPasswd string `json"etcdPasswd"`
MondbDatabases string `json"mongodbDatabases"`
}
var (
......
......@@ -91,7 +91,7 @@ func InitLogSink() (err error) {
// 选择db和collection
G_logSink = &LogSink{
client: client,
logCollection: client.Database("ichunt").Collection("cron_log"),
logCollection: client.Database(G_config.MondbDatabases).Collection("cron_log"),
logChan: make(chan *common.JobLog, 1000),
autoCommitChan: make(chan *common.LogBatch, 1000),
}
......
......@@ -20,5 +20,7 @@
"etcdUserName":"root",
"etcdPasswd":"huntmon66499",
"mongodbDatabases": "ichunt",
"execCommand": "C:\\\\cygwin64\\\\bin\\\\bash.exe"
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
"etcdDialTimeout": 5000,
"mongodb地址": "采用mongodb URI",
"mongodbUri": "mongodb://ichunt:huntmon66499@172.18.137.23:27017/ichunt?authMechanism=SCRAM-SHA-1",
"mongodbUri": "mongodb://crons:ichuntcrons@172.18.137.23:27017/crons?authMechanism=SCRAM-SHA-1",
"mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000,
......@@ -20,5 +20,8 @@
"execCommand": "/bin/bash",
"etcdUserName":"root",
"etcdPasswd":"huntmon66499"
"etcdPasswd":"huntmon66499",
"mongodbDatabases": "crons"
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment