Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
孙龙
/
go-crontab
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
165d91d0
authored
Aug 14, 2020
by
孙龙
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
up
parent
f749294e
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
37 additions
and
9 deletions
master/Config.go
master/LogMgr.go
master/main/master.json
master/main/master.json.bak
master/main/master.json.pro
worker/Config.go
worker/LogSink.go
worker/main/worker.json.bak
worker/main/worker.json.pro
master/Config.go
View file @
165d91d0
...
@@ -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
(
...
...
master/LogMgr.go
View file @
165d91d0
...
@@ -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
}
}
...
...
master/main/master.json
View file @
165d91d0
...
@@ -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
master/main/master.json.bak
View file @
165d91d0
...
@@ -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
master/main/master.json.pro
View file @
165d91d0
...
@@ -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
worker/Config.go
View file @
165d91d0
...
@@ -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
(
...
...
worker/LogSink.go
View file @
165d91d0
...
@@ -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
),
}
}
...
...
worker/main/worker.json.bak
View file @
165d91d0
...
@@ -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
worker/main/worker.json.pro
View file @
165d91d0
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment