Learn how to build a Redis cluster today. Redis is now a very common database and is very useful in nosql databases, so let's build up a Redis cluster.
First, prepare
First we want to install the C language compilation environment, we want to install Redis.
First install GCC g++
command:> apt-get install gcc
Command:> apt-get Install GCC
Or
Command: >apt-get Install build-essential
The error "Error:jemalloc/jemalloc.h:no such file or directory" may appear when make is resolved by the following command.
Command: >make malloc=libc
Second, download the Redis compilation installation
命令:> wget http://download.redis.io/releases/redis-4.0.8.tar.gz命令:> tar xzf redis-4.0.8.tar.gz命令:> cd redis-4.0.8命令:> make
命令:> make install
三、安装ruby环境
命令:> apt-get install ruby
命令:> gem install redis
四、接下来我们创建6个目录
路径为/usr/sofe/redis/redis-cluster下创建6个文件夹代表6个实例
五、进去安装redis的目录分别将redis.config配置文件cp到这6个目录。
Vi. Enter a directory configuration file to modify the configuration file
such as 7001 file
command:> cd/usr/sofe/redis/redis-cluster/7001
Command: >vim redis.config (no vim can be installed with VI or install VIM)
6.1 Modify to Daemonize Yes background boot.
6.2 Modifying the port number for the port number corresponding to the directory
6.3 IP binding binds the machine IP
6.4 Data Location
6.5 Turn on Cluster
6.6 Configuration Files
6.7 Open
The above 6 files were changed to the corresponding port number and location
Seven, the SRC directory into Redis start Redis 6 to start, pay attention to change the configuration file location
Eight, PS process to see if all start
Ix. Creating a Redis cluster
Count to Yes
Created successfully
Connecting a cluster
Go to redis src directory
Command: >redis-cli-c-H 192.168.199.135-p 7001
Operation Redis after successful connection
Linux (Ubuntu) installation Redis cluster, Redis cluster build