| | |
| | | return |
| | | } |
| | | if sqlUe.Owner != a.conf.NodeName { |
| | | ExecuteWriteSql(sqlUe.Sql, true) |
| | | //ExecuteWriteSql(sqlUe.Sql, true) |
| | | //flag, _ := ExecuteSqlByGorm(sqlUe.Sql) |
| | | //fmt.Println("userEvent exec 1 ", sqlUe.Sql, ",Result:", results) |
| | | if receiveSqlInterface != nil && sqlUe.Sql !=nil && len(sqlUe.Sql) > 0 { |
| | |
| | | } |
| | | |
| | | //Init serf Init |
| | | func Init(clusterID string, password string, nodeID string, addrs []string) (*Agent, error) { |
| | | agent, err := InitNode(clusterID, password, nodeID) |
| | | func Init(clusterID string, password string, nodeID string, addrs []string, snapshotPath string) (*Agent, error) { |
| | | agent, err := InitNode(clusterID, password, nodeID, snapshotPath) |
| | | if err != nil { |
| | | //fmt.Printf("InitNode failed, error: %s", err) |
| | | return agent, err |
| | |
| | | } |
| | | |
| | | //InitNode web后台收到创建集群的请求, |
| | | func InitNode(clusterID string, password string, nodeID string) (*Agent, error) { |
| | | func InitNode(clusterID string, password string, nodeID string, snapshotPath string) (*Agent, error) { |
| | | conf := DefaultConfig() |
| | | //fmt.Println("clusterID:", clusterID, "password:", password, "nodeID:", nodeID) |
| | | conf.ClusterID = clusterID |
| | |
| | | } |
| | | conf.EncryptKey = password |
| | | } |
| | | agent, err := Create(conf) |
| | | agent, err := Create(conf, snapshotPath) |
| | | if err != nil { |
| | | //fmt.Printf("create agent failed, error: %s", err) |
| | | return agent, err |