acl/app/redis_tools/redis_builder
2019-06-10 09:15:12 +08:00
..
changes.txt redis builder: all commands support auth. 2017-12-27 10:26:06 +08:00
cluster.xml add a redis tool for redis cluster 2015-04-19 07:15:30 -07:00
main.cpp make acl_threads_server.c friendly to valgrind 2016-04-23 20:30:49 +08:00
Makefile add a redis tool for redis cluster 2015-04-19 07:15:30 -07:00
Makefile.in compiling redis_builder 2019-06-10 09:15:12 +08:00
nodes1.xml add some useful function to redis_builder tool 2015-04-25 09:11:10 -07:00
nodes2.xml add some useful function to redis_builder tool 2015-04-25 09:11:10 -07:00
nodes3.xml add some useful function to redis_builder tool 2015-04-25 09:11:10 -07:00
nodes4.xml add some useful function to redis_builder tool 2015-04-25 09:11:10 -07:00
ReadMe.md modify Readme.md for redis_builder 2015-04-25 09:47:37 -07:00
redis_builder_vc2012.sln add a redis tool for redis cluster 2015-04-19 07:15:30 -07:00
redis_builder_vc2012.vcxproj make redis_builder more powerful; replace polarssl with new version 2016-04-12 20:11:15 +08:00
redis_builder_vc2012.vcxproj.filters make redis_builder more powerful; replace polarssl with new version 2016-04-12 20:11:15 +08:00
redis_builder_vc2015.sln compile acl on vc2015 successfully 2016-04-30 11:49:41 +08:00
redis_builder_vc2015.vcxproj compile acl on vc2015 successfully 2016-04-30 11:49:41 +08:00
redis_builder_vc2015.vcxproj.filters compile acl on vc2015 successfully 2016-04-30 11:49:41 +08:00
redis_builder.cpp redis_builder can builder and operation redis cluster with password 2016-03-13 20:01:41 +08:00
redis_builder.h redis_builder can builder and operation redis cluster with password 2016-03-13 20:01:41 +08:00
redis_cmdump.cpp redis builder: all commands support auth. 2017-12-27 10:26:06 +08:00
redis_cmdump.h add master web monitor by master_fiber mode; arrange codes; add methods to json module; 2016-07-29 16:43:46 +08:00
redis_commands.cpp fixed bugs in redis_builder 2019-03-28 11:35:19 +08:00
redis_commands.h fixed bugs in redis_builder 2019-03-28 11:35:19 +08:00
redis_commands.txt modify lib_fiber module 2017-07-03 16:00:05 +08:00
redis_migrate.cpp redis_builder can builder and operation redis cluster with password 2016-03-13 20:01:41 +08:00
redis_migrate.h redis_builder can builder and operation redis cluster with password 2016-03-13 20:01:41 +08:00
redis_monitor.cpp redis builder: all commands support auth. 2017-12-27 10:26:06 +08:00
redis_monitor.h optimize some codes 2016-05-10 21:58:47 +08:00
redis_reshard.cpp redis builder: all commands support auth. 2017-12-27 10:26:06 +08:00
redis_reshard.h redis_builder can builder and operation redis cluster with password 2016-03-13 20:01:41 +08:00
redis_status.cpp redis_builder can builder and operation redis cluster with password 2016-03-13 20:01:41 +08:00
redis_status.h redis_builder can builder and operation redis cluster with password 2016-03-13 20:01:41 +08:00
redis_util.cpp acl 3.2.0 released! 2016-08-27 18:34:02 +08:00
redis_util.h acl 3.2.0 released! 2016-08-27 18:34:02 +08:00
stdafx.cpp add a redis tool for redis cluster 2015-04-19 07:15:30 -07:00
stdafx.h add a redis tool for redis cluster 2015-04-19 07:15:30 -07:00
valgrind.sh add some useful function to redis_builder tool 2015-04-25 09:11:10 -07:00

A redis tool for redis cluster, which can help to build a new redis cluster, add one new redis node to the existing one or cluster, show the information of the redis cluster about nodes and slots. Below are the using method of the tool:

1) show help information:

./redis_build -h
usage: redis_builder.exe -h[help]
-s redis_addr[ip:port]
-a cmd[nodes|slots|create|add_node|del_node|node_id|reshard]
-N new_node[ip:port]
-S [add node as slave]
-f configure_file

for samples:
./redis_builder -s 127.0.0.1:6379 -a create -f cluster.xml
./redis_builder -s 127.0.0.1:6379 -a nodes
./redis_builder -s 127.0.0.1:6379 -a slots
./redis_builder -s 127.0.0.1:6379 -a del_node -I node_id
./redis_builder -s 127.0.0.1:6379 -a node_id
./redis_builder -s 127.0.0.1:6379 -a add_node -N 127.0.0.1:6380 -S
./redis_builder -s 127.0.0.1:6379 -a reshard

2) build a new redis cluster after all of the redis nodes started:

2.1) build cluster and the relationship between master and slave

was specified by the configuer file. ./redis_builder -a create -f cluster.xml the cluster.xml's content just like:

<?xml version="1.0"?>
<xml>
    <node addr = "192.168.136.172:16380">
        <node addr = "192.168.136.172:16381" />
        <node addr = "192.168.136.172:16382" />
    </node>
    <node addr = "192.168.136.172:16383">
        <node addr = "192.168.136.172:16384" />
        <node addr = "192.168.136.172:16385" />
    </node>
    <node addr = "192.168.136.172:16386">
        <node addr = "192.168.136.172:16387" />
        <node addr = "192.168.136.172:16388" />
    </node>
</xml>

The result maybe like as:

master: 192.168.136.172:16380
        slave: 192.168.136.172:16381
        slave: 192.168.136.172:16382
master: 192.168.136.172:16383
        slave: 192.168.136.172:16384
        slave: 192.168.136.172:16385
master: 192.168.136.172:16386
        slave: 192.168.136.172:16387
        slave: 192.168.136.172:16388

2.2) build cluster and the relationship between master and slave was specified

by the command args. ./redis_builder -a create -r 2 -f cluster.xml the cluster.xml's content just like:

<?xml version="1.0"?>
<xml>
    <node addr = "192.168.136.171:16380" />
    <node addr = "192.168.136.171:16381" />
    <node addr = "192.168.136.171:16382" />
    <node addr = "192.168.136.172:16383" />
    <node addr = "192.168.136.172:16384" />
    <node addr = "192.168.136.172:16385" />
    <node addr = "192.168.136.173:16386" />
    <node addr = "192.168.136.173:16387" />
    <node addr = "192.168.136.173:16388" />
</xml>

The redis_builder will create three master nodes that each master will have two slave nodes. The three master will be in different hosts, and each master's slave nodes will be in other host than its master. The redis nodes of the cluster maybe like as:

master: 192.168.136.171:16380
        slave: 192.168.136.172:16383
        slave: 192.168.136.173:16386
master: 192.168.136.172:16384
        slave: 192.168.136.173:16388
        slave: 192.168.136.171:16382
master: 192.168.136.173:16387
        slave: 192.168.136.172:16385
        slave: 192.168.136.171:16381

3) add a new slave redis node to the master node:

./redis_builder -s 127.0.0.1:6379 -a add_node -S -N 127.0.0.1:6380
'-s' specifys the existing master node,
'-S' specifys the new redis node added was as a slave node,
'-N' specify the new redis addr to be added
'-a' specify the cmd of this tool

4) compile this redis_builder tool

4.1) build the base three libs for redis_builder:

because redis_builder depends on lib_acl/lib_protocol/lib_acl_cpp, so you need to compile the lib_acl/lib_protocol/lib_acl_cpp first

$cd lib_acl; make
$cd lib_protocol; make
$cd lib_acl_cpp; make

4.2) compile redis_builder

$cd app/redis_tools/redis_builder; make

5) reference