Redis has been recently used for project reasons, and the installation and configuration of Redis are documented for easy viewing.
1. Download
Address http://download.redis.io/releases/which version is needed to use that version
2. Unzip and compile
1.tar Xzf redis-3.0.5.tar.gz
2. Enter redis-3.0.5
3. Make
4. Make Test
5. Make install here will prompt Hint to run ' made test ' is a good ideas will let you run make test now that the installation is successful. You can ignore this if everything goes well in front of you.
6. Modify the configuration here the main configuration is the MASTR configuration needs to be aware of the place
6.1 Post here is the port used. Can change
6.2 Requirepass Here is a security consideration, you can set the password.
7. After the modification is complete, copy to/etc/below
8. Write a self-initiated script to/etc/init.d/redis I got a copy of this from Xsi64.
9. Running with the system
sudo chkconfig redis on
This is CentOS, not every system can use this.
10. Start the Redis service
And then Redis-cli.
If there's no problem, you'll see.
127.0.0.1:6379>
Configuration of 11.slave
Basically no difference from master, there are a few points to note
1. Configuration port needs to use non 6379 if the previous use of the 6379 specific port can be set by itself
2. If master uses a password in slave configuration, it is also set to Masterauth bt8888
3. Set the master's information in the From-Port 6380
slaveof IP 6379
4. If it is Ubuntu please pay special attention to the issue of permissions, if the permissions are not possible, here can view the log if there is a problem
After the success of the REDIS-CLI with the previously configured I here is 6380 will also be the same as before the 127.0.0.1:6380> here does not necessarily represent a successful configuration. Execute info
If it appears
# Replication
Role:slave
Master_host:ip
master_port:6379
Master_link_status:up
Master_last_io_seconds_ago:5
master_sync_in_progress:0
slave_repl_offset:7309
slave_priority:100
Slave_read_only:1
connected_slaves:0
master_repl_offset:0
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
This time the explanation succeeds. Execute keys * and you'll see that Master has synced over. The default is read-write separation can be changed
If you try to write
127.0.0.1:6380> Set 123 456
(Error) READONLY you can ' t write against a read only slave.
The integration is complete here.
Redis Linux installation and simple cluster configuration