Commit 0f3776a9 by 孙龙

init

parent ee06b3f0
...@@ -5,7 +5,7 @@ import ( ...@@ -5,7 +5,7 @@ import (
"net" "net"
"time" "time"
"strconv" "strconv"
"github.com/owenliang/crontab/common" "go-crontab/common"
"encoding/json" "encoding/json"
) )
......
...@@ -3,7 +3,7 @@ package master ...@@ -3,7 +3,7 @@ package master
import ( import (
"github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/clientv3"
"time" "time"
"github.com/owenliang/crontab/common" "go-crontab/common"
"encoding/json" "encoding/json"
"context" "context"
"github.com/coreos/etcd/mvcc/mvccpb" "github.com/coreos/etcd/mvcc/mvccpb"
......
package master package master
import ( import (
"github.com/mongodb/mongo-go-driver/mongo" "go.mongodb.org/mongo-driver/mongo"
"context" "context"
"github.com/mongodb/mongo-go-driver/mongo/clientopt" "go.mongodb.org/mongo-driver/mongo/options"
"time" "go-crontab/common"
"github.com/owenliang/crontab/common"
"github.com/mongodb/mongo-go-driver/mongo/findopt"
) )
// mongodb日志管理 // mongodb日志管理
...@@ -25,10 +23,10 @@ func InitLogMgr() (err error) { ...@@ -25,10 +23,10 @@ func InitLogMgr() (err error) {
) )
// 建立mongodb连接 // 建立mongodb连接
// 建立mongodb连接
clientOptions := options.Client().ApplyURI("mongodb://ichunt:huntmon6699@192.168.1.237:27017/ichunt?authMechanism=SCRAM-SHA-1")
if client, err = mongo.Connect( if client, err = mongo.Connect(
context.TODO(), context.TODO(),clientOptions); err != nil {
G_config.MongodbUri,
clientopt.ConnectTimeout(time.Duration(G_config.MongodbConnectTimeout) * time.Millisecond)); err != nil {
return return
} }
......
...@@ -4,7 +4,7 @@ import ( ...@@ -4,7 +4,7 @@ import (
"github.com/coreos/etcd/clientv3" "github.com/coreos/etcd/clientv3"
"time" "time"
"context" "context"
"github.com/owenliang/crontab/common" "go-crontab/common"
"github.com/coreos/etcd/mvcc/mvccpb" "github.com/coreos/etcd/mvcc/mvccpb"
) )
......
...@@ -2,7 +2,7 @@ package main ...@@ -2,7 +2,7 @@ package main
import ( import (
"runtime" "runtime"
"github.com/owenliang/crontab/master" "go-crontab/master"
"fmt" "fmt"
"flag" "flag"
"time" "time"
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
"apiWriteTimeout": 5000, "apiWriteTimeout": 5000,
"etcd的集群列表": "配置多个, 避免单点故障", "etcd的集群列表": "配置多个, 避免单点故障",
"etcdEndpoints": ["36.111.184.221:2379"], "etcdEndpoints": ["192.168.2.232:2379"],
"etcd的连接超时": "单位毫秒", "etcd的连接超时": "单位毫秒",
"etcdDialTimeout": 5000, "etcdDialTimeout": 5000,
......
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