这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,36 @@ You can see the result in JSON format. The result of the above command is:

Recommend 3 or more odd number of nodes in the cluster. In failure scenarios, data loss is inevitable, so avoid deploying single nodes.

The above example, the node joins to the cluster at startup, but you can also join the node that already started on standalone mode to the cluster later, as follows:

```bash
$ ./bin/cete join --grpc-addr=:9000 node2 127.0.0.1:9001
```

or, you can use the RESTful API as follows:

```bash
$ curl -X PUT 'http://127.0.0.1:8000/v1/cluster/node2' --data-binary '
{
"bind_addr": ":7001",
"grpc_addr": ":9001",
"http_addr": ":8001"
}
'
```

To remove a node from the cluster, execute the following command:

```bash
$ ./bin/cete leave --grpc-addr=:9000 node2
```

or, you can use the RESTful API as follows:

```bash
$ curl -X DELETE 'http://127.0.0.1:8000/v1/cluster/node2'
```

The following command indexes documents to any node in the cluster:

```bash
Expand Down
15 changes: 15 additions & 0 deletions kvs/marshaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ func (j *CeteMarshaler) NewDecoder(r io.Reader) runtime.Decoder {
case *pbkvs.PutRequest:
v.(*pbkvs.PutRequest).Value = buffer
return nil
case *pbkvs.JoinRequest:
var tmpValue map[string]interface{}
if err = json.Unmarshal(buffer, &tmpValue); err != nil {
return err
}
if bindAddr, ok := tmpValue["bind_addr"].(string); ok {
v.(*pbkvs.JoinRequest).BindAddr = bindAddr
}
if grpcAddr, ok := tmpValue["grpc_addr"].(string); ok {
v.(*pbkvs.JoinRequest).GrpcAddr = grpcAddr
}
if httpAddr, ok := tmpValue["http_addr"].(string); ok {
v.(*pbkvs.JoinRequest).HttpAddr = httpAddr
}
return nil
default:
return json.Unmarshal(buffer, v)
}
Expand Down
Loading