Commit 165d91d0 by 孙龙

up

parent f749294e
...@@ -17,6 +17,7 @@ type Config struct { ...@@ -17,6 +17,7 @@ type Config struct {
MongodbConnectTimeout int `json:"mongodbConnectTimeout"` MongodbConnectTimeout int `json:"mongodbConnectTimeout"`
EtcdUserName string `json"etcdUserName"` EtcdUserName string `json"etcdUserName"`
EtcdPasswd string `json"etcdPasswd"` EtcdPasswd string `json"etcdPasswd"`
MondbDatabases string `json"mongodbDatabases"`
} }
var ( var (
......
...@@ -24,7 +24,8 @@ func InitLogMgr() (err error) { ...@@ -24,7 +24,8 @@ func InitLogMgr() (err error) {
// 建立mongodb连接 // 建立mongodb连接
// 建立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( if client, err = mongo.Connect(
context.TODO(),clientOptions); err != nil { context.TODO(),clientOptions); err != nil {
return return
...@@ -32,7 +33,7 @@ func InitLogMgr() (err error) { ...@@ -32,7 +33,7 @@ func InitLogMgr() (err error) {
G_logMgr = &LogMgr{ G_logMgr = &LogMgr{
client: client, client: client,
logCollection: client.Database("cron").Collection("log"), logCollection: client.Database(G_config.MondbDatabases).Collection("log"),
} }
return return
} }
......
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
"mongodb连接超时时间": "单位毫秒", "mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000, "mongodbConnectTimeout": 5000,
"etcdUserName":"root", "etcdUserName":"root",
"etcdPasswd":"huntmon66499"
"etcdPasswd":"huntmon66499",
"mongodbDatabases": "ichunt"
} }
\ No newline at end of file
...@@ -22,6 +22,13 @@ ...@@ -22,6 +22,13 @@
"mongodb连接超时时间": "单位毫秒", "mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000, "mongodbConnectTimeout": 5000,
"etcdUserName":"", "etcdUserName":"",
"etcdPasswd":""
"etcdPasswd":"",
"mongodbDatabases": "ichunt"
} }
\ No newline at end of file
...@@ -18,11 +18,14 @@ ...@@ -18,11 +18,14 @@
"webroot": "./webroot", "webroot": "./webroot",
"mongodb地址": "采用mongodb URI", "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连接超时时间": "单位毫秒", "mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000, "mongodbConnectTimeout": 5000,
"etcdUserName":"root", "etcdUserName":"root",
"etcdPasswd":"huntmon66499"
"etcdPasswd":"huntmon66499",
"mongodbDatabases": "crons"
} }
\ No newline at end of file
...@@ -16,6 +16,7 @@ type Config struct { ...@@ -16,6 +16,7 @@ type Config struct {
ExecCommand string `json"execCommand"` ExecCommand string `json"execCommand"`
EtcdUserName string `json"etcdUserName"` EtcdUserName string `json"etcdUserName"`
EtcdPasswd string `json"etcdPasswd"` EtcdPasswd string `json"etcdPasswd"`
MondbDatabases string `json"mongodbDatabases"`
} }
var ( var (
......
...@@ -91,7 +91,7 @@ func InitLogSink() (err error) { ...@@ -91,7 +91,7 @@ func InitLogSink() (err error) {
// 选择db和collection // 选择db和collection
G_logSink = &LogSink{ G_logSink = &LogSink{
client: client, client: client,
logCollection: client.Database("ichunt").Collection("cron_log"), logCollection: client.Database(G_config.MondbDatabases).Collection("cron_log"),
logChan: make(chan *common.JobLog, 1000), logChan: make(chan *common.JobLog, 1000),
autoCommitChan: make(chan *common.LogBatch, 1000), autoCommitChan: make(chan *common.LogBatch, 1000),
} }
......
...@@ -20,5 +20,7 @@ ...@@ -20,5 +20,7 @@
"etcdUserName":"root", "etcdUserName":"root",
"etcdPasswd":"huntmon66499", "etcdPasswd":"huntmon66499",
"mongodbDatabases": "ichunt",
"execCommand": "C:\\\\cygwin64\\\\bin\\\\bash.exe" "execCommand": "C:\\\\cygwin64\\\\bin\\\\bash.exe"
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
"etcdDialTimeout": 5000, "etcdDialTimeout": 5000,
"mongodb地址": "采用mongodb URI", "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连接超时时间": "单位毫秒", "mongodb连接超时时间": "单位毫秒",
"mongodbConnectTimeout": 5000, "mongodbConnectTimeout": 5000,
...@@ -20,5 +20,8 @@ ...@@ -20,5 +20,8 @@
"execCommand": "/bin/bash", "execCommand": "/bin/bash",
"etcdUserName":"root", "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