catalogue
2, Install and deploy go and codis
3. codis environment installation and deployment
2. Add two instances in the browser
1, Introduction
Codis is a distributed Redis solution. For upper tier applications, there is no significant difference between connecting to Codis Proxy and connecting to native Redis Server( List of unsupported commands ), the upper layer application can be used like Redis using a single machine. The bottom layer of Codis will handle the forwarding of requests, non-stop data migration and other work. Everything behind is transparent to the front client. You can simply think that the back connected is a server with unlimited memory
Redis service features:
Auto balance
It's very easy to use
Graphical panels and management tools
It supports most Redis commands and is fully compatible with twoproxy
Support Redis Native Client
Safe and transparent data migration, which can easily add and delete nodes as needed
Provide command line interface
RESTful APIs service.
2, Install and deploy go and codis
1. Download
go Download path: https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz codis Installation website: https://codeload.github.com/CodisLabs/codis/zip/release3.2 Copy to server1 scp root@172.25.254.34:/home/westos/Desktop/go1.8.3.linux-amd64.tar.gz /root scp root@172.25.254.34:/home/westos/Desktop/codis-release3.2.zip /root
2. Deploy go
Note: when deploying codis, you must turn off redis. Be sure to turn off redis. Be sure to turn off redis. Otherwise, the port will be occupied.
/etc/init.d/redis_6379 stop
Unzip the compressed package to the user level program installation directory / usr/local. Modify the environment variable and take effect. Finally, go version checks whether the go environment is complete.
cd /usr/local/ ls tar zxf /root/go1.8.3.linux-amd64.tar.gz ls ##The go directory appears cd #To / root directory vim .bash_profile /// PATH=$PATH:$HOME/bin:/usr/local/go/bin/ /// source .bash_profile go version /// go version go1.8.3 linux/amd64 #success ///
3. codis environment installation and deployment
Install codis in the go directory, create a new directory, unzip and rename it, and then make.
mkdir -p /usr/local/go/src/github.com/CodisLabs 685 cd /usr/local/go/src/github.com/CodisLabs 686 mv /root/codis-release3.2.zip . 687 unzip codis-release3.2.zip 688 ls 689 mv codis-release3.2 codis #rename 690 ls 691 cd codis 692 ls 693 yum install autoconf #Resolve dependencies 694 yum install git #Resolve dependencies 695 make
4. codis start
(1) Start CODIS dashboard
Use CODIS dashboard admin The SH script starts the dashboard and checks the dashboard log to see if there are any exceptions.
cd /usr/local/go/src/github.com/CodisLabs/codis ./admin/codis-dashboard-admin.sh start #Launch dashboard vim log/codis-dashboard.log.2022-01-20 #view log
(2) Start CODIS proxy
Use CODIS proxy admin The SH script starts CODIS proxy and checks the proxy log to confirm whether there is any exception during startup.
./admin/codis-proxy-admin.sh start cat log/codis-proxy.log.2022-01-20
(3) Start CODIS server
Use CODIS server admin The SH script starts the CODIS server and checks the redis log to see if there are any exceptions.
./admin/codis-server-admin.sh start tial -n 100 /tmp/redis_6379.log
(4) Start CODIS Fe
Use CODIS fe admin The SH script starts CODIS fe and checks the fe log to see if there is any exception during startup.
./admin/codis-fe-admin.sh start tial -n 100 log/codis-fe.log.2022-01-20
3, Add group through fe
Visit the cluster management page 172.25.24.1:9090 in the browser and select the newly built cluster CODIS demo. You can see the started Proxy in the Proxy column. The Group column is empty because the started Codis Server is not added to the cluster. Add NEW GROUP, enter 1, and then click NEW GROUP to add Codis Server. In the Add Server line, enter the Codis Server address 127.0.0.1:6379, Add to the NEW GROUP and click Add Server.
4, Initialize slot through fe
The slot status of the new cluster is offline and needs to be initialized, that is, 1024 slots are allocated to each group. The fastest way to initialize is through the rebalance all slots button provided by fe. Click to complete the cluster construction.
5, Cluster configuration
1. Add two Redis instances
Add 6380 and 6381 Redis instances respectively.
cp config/redis.conf config/redis6380.conf cp config/redis.conf config/redis6381.conf
vim config/redis6380.conf /// 84 port 6380 150 pidfile /tmp/redis_6380.pid 163 logfile "/tmp/redis_6380.log" /// ./bin/codis-server ./config/redis6380.conf ##Start the new Redis instance
vim config/redis6381.conf /// 84 port 6381 150 pidfile /tmp/redis_6381.pid 163 logfile "/tmp/redis_6381.log" /// ./bin/codis-server ./config/redis6381.conf ##Start the new Redis instance
2. Add two instances in the browser
The default state just added is NO:ONE. Click the small wrench.
[note] after cluster management is enabled, only 6379 can be read and written, and the other two only have read permission