Connecting to 192.168.159.12:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Fri Mar 27 09:51:56 2020 from 192.168.159.1
[root@centos7002 ~]# cd /myredis/
[root@centos7002 myredis]# ls -l
总用量 192
-rw-r--r-- 1 root root 61799 3月 25 19:06 redis_aof.conf
-rw-r--r-- 1 root root 61798 3月 23 11:35 redis.conf
-rw-r--r-- 1 root root 61797 3月 10 15:04 redis-init.conf
[root@centos7002 myredis]# cp redis.conf redis6379.conf
[root@centos7002 myredis]# cp redis.conf redis6380.conf
[root@centos7002 myredis]# cp redis.conf redis6381.conf
[root@centos7002 myredis]# ls -l
总用量 384
-rw-r--r-- 1 root root 61798 3月 27 10:10 redis6379.conf
-rw-r--r-- 1 root root 61798 3月 27 10:10 redis6380.conf
-rw-r--r-- 1 root root 61798 3月 27 10:10 redis6381.conf
-rw-r--r-- 1 root root 61799 3月 25 19:06 redis_aof.conf
-rw-r--r-- 1 root root 61798 3月 23 11:35 redis.conf
-rw-r--r-- 1 root root 61797 3月 10 15:04 redis-init.conf
[root@centos7002 myredis]# vi redis6379.conf
[root@centos7002 myredis]# vi redis6379.conf
[root@centos7002 myredis]# vi redis6380.conf
[root@centos7002 myredis]# vi redis6380.conf
[root@centos7002 myredis]# vi redis6381.conf
[root@centos7002 myredis]# redis-server /myredis/redis6379.conf
[root@centos7002 myredis]# red
red redis-check-aof redis-cli redis-server
redis-benchmark redis-check-rdb redis-sentinel
[root@centos7002 myredis]# redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> keys *
1) "k5"
2) "k3"
3) "debt"
4) "k1"
5) "balance"
6) "k2"
7) "k4"
127.0.0.1:6379> info replication
# Replication
role:master
connected_slaves:0
master_replid:6ec1901b3021b2f8b5ac2b9bb0d0105f07fcdb11
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
127.0.0.1:6379> set k6 v6
OK
127.0.0.1:6379> info replication
# Replication
role:master
connected_slaves:2
slave0:ip=127.0.0.1,port=6381,state=online,offset=262,lag=1
slave1:ip=127.0.0.1,port=6380,state=online,offset=262,lag=1
master_replid:94ef8e60e3a65d8725fbe19c3bee14d61c9f747e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:262
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:262
127.0.0.1:6379> set k7 v7
OK
127.0.0.1:6379> shutdown
not connected> exit
[root@centos7002 myredis]# cd /usr/local/bin/
[root@centos7002 bin]# redis-server /myredis/redis6379.conf
[root@centos7002 bin]# redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379> keys *
(empty list or set)
127.0.0.1:6379> info replication
# Replication
role:master
connected_slaves:2
slave0:ip=127.0.0.1,port=6380,state=online,offset=84,lag=1
slave1:ip=127.0.0.1,port=6381,state=online,offset=84,lag=1
master_replid:037f5877f0fadb01713e95b1e4317b385c0e3c4b
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:84
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:84
127.0.0.1:6379> set k1 v1
OK
127.0.0.1:6379> keys *
1) "k1"
127.0.0.1:6379> set k2 v2
OK
127.0.0.1:6379> set k3 v3
OK
127.0.0.1:6379>
Connecting to 192.168.159.12:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Fri Mar 27 10:09:37 2020 from 192.168.159.1
[root@centos7002 ~]# cd /usr/local/bin/
[root@centos7002 bin]# redis-server /myredis/redis6380.conf
[root@centos7002 bin]# redis-cli -p 6380
127.0.0.1:6380> ping
PONG
127.0.0.1:6380> keys *
(empty list or set)
127.0.0.1:6380> info replication
# Replication
role:master
connected_slaves:0
master_replid:4f2bcd59d0657f70196cee2aeca8b52c17599d5c
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
127.0.0.1:6380> slaveof 127.0.0.1 6379
OK
127.0.0.1:6380> get k6
"v6"
127.0.0.1:6380> get k1
"v1"
127.0.0.1:6380> info replication
# Replication
role:slave
master_host:127.0.0.1
master_port:6379
master_link_status:up
master_last_io_seconds_ago:8
master_sync_in_progress:0
slave_repl_offset:304
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:94ef8e60e3a65d8725fbe19c3bee14d61c9f747e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:304
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:29
repl_backlog_histlen:276
127.0.0.1:6380> set k7 v77
(error) READONLY You can't write against a read only replica.
127.0.0.1:6380> info replication
# Replication
role:slave
master_host:127.0.0.1
master_port:6379
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:0
slave_repl_offset:1145
master_link_down_since_seconds:13
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:94ef8e60e3a65d8725fbe19c3bee14d61c9f747e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1145
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:29
repl_backlog_histlen:1117
127.0.0.1:6380> keys *
(empty list or set)
127.0.0.1:6380> get k1
"v1"
127.0.0.1:6380> keys *
1) "k1"
127.0.0.1:6380> shutdown
not connected> exit
[root@centos7002 bin]# redis-server /myredis/redis6380.conf
[root@centos7002 bin]# redis-cli -p 6380
127.0.0.1:6380> ping
PONG
127.0.0.1:6380> keys *
1) "k1"
127.0.0.1:6380> shutdown
not connected> exit
[root@centos7002 bin]# redis-server /myredis/redis6380.conf
[root@centos7002 bin]# redis-cli -p 6380
127.0.0.1:6380> keys *
1) "k1"
127.0.0.1:6380> info replication
# Replication
role:master
connected_slaves:0
master_replid:b22af0635dddf1e61fb28816cec7e10835f5072e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
127.0.0.1:6380> get k2
(nil)
127.0.0.1:6380> slaveof 127.0.0.1 6379
OK
127.0.0.1:6380> keys *
1) "k2"
2) "k1"
3) "k3"
127.0.0.1:6380>
Connecting to 192.168.159.12:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Fri Mar 27 11:03:32 2020 from 192.168.159.1
[root@centos7002 ~]# redis-server /myredis/redis6381.conf
[root@centos7002 ~]# redis-cli -p 6381
127.0.0.1:6381> ping
PONG
127.0.0.1:6381> keys *
(empty list or set)
127.0.0.1:6381> info replication
# Replication
role:master
connected_slaves:0
master_replid:949a8c6dd2d1a5b588d7173d4b5e64b5e6de70ad
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
127.0.0.1:6381> SLAVEOF 127.0.0.1 6379
OK
127.0.0.1:6381> get k4
"v4"
127.0.0.1:6381> get k2
"22"
127.0.0.1:6381> info replication
# Replication
role:slave
master_host:127.0.0.1
master_port:6379
master_link_status:up
master_last_io_seconds_ago:10
master_sync_in_progress:0
slave_repl_offset:332
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:94ef8e60e3a65d8725fbe19c3bee14d61c9f747e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:332
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:332
127.0.0.1:6381> set k7 v777
(error) READONLY You can't write against a read only replica.
127.0.0.1:6381> keys *
1) "k4"
2) "debt"
3) "balance"
4) "k5"
5) "k6"
6) "k2"
7) "k3"
8) "k1"
9) "k7"
127.0.0.1:6381> shutdown
not connected> exit
[root@centos7002 ~]# redis-cli -p 6381
Could not connect to Redis at 127.0.0.1:6381: Connection refused
not connected> exit
[root@centos7002 ~]# cd /usr/local/bin/
[root@centos7002 bin]# redis-server /myredis/redis6381.conf
[root@centos7002 bin]# redis-cli -p 6381
127.0.0.1:6381> ping
PONG
127.0.0.1:6381> keys *
(empty list or set)
127.0.0.1:6381> info replication
# Replication
role:master
connected_slaves:0
master_replid:189d3cfceee3e0125907259f4f2f4d77da11126e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:0
second_repl_offset:-1
repl_backlog_active:0
repl_backlog_size:1048576
repl_backlog_first_byte_offset:0
repl_backlog_histlen:0
127.0.0.1:6381> SLAVEOF 127.0.0.1 6381
OK
127.0.0.1:6381> keys *
(empty list or set)
127.0.0.1:6381> SLAVEOF 127.0.0.1 6379
OK
127.0.0.1:6381> keys *
1) "k4"
2) "k3"
3) "k2"
4) "k1"
5) "debt"
6) "k6"
7) "balance"
8) "k5"
9) "k7"
127.0.0.1:6381> info replication
# Replication
role:slave
master_host:127.0.0.1
master_port:6379
master_link_status:up
master_last_io_seconds_ago:10
master_sync_in_progress:0
slave_repl_offset:935
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:94ef8e60e3a65d8725fbe19c3bee14d61c9f747e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:935
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:880
repl_backlog_histlen:56
127.0.0.1:6381> info replication
# Replication
role:slave
master_host:127.0.0.1
master_port:6379
master_link_status:down
master_last_io_seconds_ago:-1
master_sync_in_progress:0
slave_repl_offset:1145
master_link_down_since_seconds:26
slave_priority:100
slave_read_only:1
connected_slaves:0
master_replid:94ef8e60e3a65d8725fbe19c3bee14d61c9f747e
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:1145
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:880
repl_backlog_histlen:266
127.0.0.1:6381> keys *
1) "k4"
2) "k3"
3) "k2"
4) "k1"
5) "debt"
6) "k6"
7) "balance"
8) "k5"
9) "k7"
127.0.0.1:6381> get k1
"v1"
127.0.0.1:6381> keys *
1) "k1"
127.0.0.1:6381> get k2
"v2"
127.0.0.1:6381> get k3
"v3"
127.0.0.1:6381>
Connecting to 192.168.159.12:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Last login: Fri Mar 27 11:08:13 2020 from 192.168.159.1
[root@centos7002 ~]# cd /myredis/
[root@centos7002 myredis]# ls -l
总用量 388
-rw-r--r-- 1 root root 496 3月 27 11:04 6379.log
-rw-r--r-- 1 root root 61810 3月 27 10:18 redis6379.conf
-rw-r--r-- 1 root root 61810 3月 27 10:48 redis6380.conf
-rw-r--r-- 1 root root 61810 3月 27 11:01 redis6381.conf
-rw-r--r-- 1 root root 61799 3月 25 19:06 redis_aof.conf
-rw-r--r-- 1 root root 61798 3月 23 11:35 redis.conf
-rw-r--r-- 1 root root 61797 3月 10 15:04 redis-init.conf
[root@centos7002 myredis]# vi redis6379.conf
[root@centos7002 myredis]# cd /usr/local/bin/
[root@centos7002 bin]# ls -l
总用量 32748
-rw-r--r-- 1 root root 2496 3月 27 11:07 6380.log
-rw-r--r-- 1 root root 1187 3月 26 13:16 appendonly.aof
-rw-r--r-- 1 root root 149 3月 26 13:25 dump.rdb
-rwxr-xr-x 1 root root 4366608 3月 10 14:20 redis-benchmark
-rwxr-xr-x 1 root root 8111816 3月 10 14:20 redis-check-aof
-rwxr-xr-x 1 root root 8111816 3月 10 14:20 redis-check-rdb
-rwxr-xr-x 1 root root 4806832 3月 10 14:20 redis-cli
lrwxrwxrwx 1 root root 12 3月 10 14:20 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 8111816 3月 10 14:20 redis-server
[root@centos7002 bin]# cd /myredis/
[root@centos7002 myredis]# ls -l
总用量 388
-rw-r--r-- 1 root root 496 3月 27 11:04 6379.log
-rw-r--r-- 1 root root 61810 3月 27 10:18 redis6379.conf
-rw-r--r-- 1 root root 61810 3月 27 10:48 redis6380.conf
-rw-r--r-- 1 root root 61810 3月 27 11:01 redis6381.conf
-rw-r--r-- 1 root root 61799 3月 25 19:06 redis_aof.conf
-rw-r--r-- 1 root root 61798 3月 23 11:35 redis.conf
-rw-r--r-- 1 root root 61797 3月 10 15:04 redis-init.conf
[root@centos7002 myredis]# vi redis6379.conf
[root@centos7002 myredis]# vi redis6380.conf
[root@centos7002 myredis]# vi redis6381.conf
[root@centos7002 myredis]# cd /usr/local/bin/
[root@centos7002 bin]# ls -l
总用量 32748
-rw-r--r-- 1 root root 2496 3月 27 11:07 6380.log
-rw-r--r-- 1 root root 1187 3月 26 13:16 appendonly.aof
-rw-r--r-- 1 root root 149 3月 26 13:25 dump.rdb
-rwxr-xr-x 1 root root 4366608 3月 10 14:20 redis-benchmark
-rwxr-xr-x 1 root root 8111816 3月 10 14:20 redis-check-aof
-rwxr-xr-x 1 root root 8111816 3月 10 14:20 redis-check-rdb
-rwxr-xr-x 1 root root 4806832 3月 10 14:20 redis-cli
lrwxrwxrwx 1 root root 12 3月 10 14:20 redis-sentinel -> redis-server
-rwxr-xr-x 1 root root 8111816 3月 10 14:20 redis-server
[root@centos7002 bin]# vi 6380.log
[root@centos7002 bin]# ps -ef|grep redis
root 17104 13811 0 11:04 pts/4 00:00:00 redis-cli -p 6379
root 17248 1 0 11:07 ? 00:00:01 redis-server 127.0.0.1:6380
root 17292 16996 0 11:07 pts/1 00:00:00 redis-cli -p 6380
root 17390 1 0 11:08 ? 00:00:01 redis-server 127.0.0.1:6381
root 17407 17320 0 11:08 pts/2 00:00:00 redis-cli -p 6381
root 18212 17518 0 11:20 pts/0 00:00:00 grep --color=auto redis
root 27169 1 0 3月26 ? 00:01:57 redis-server 127.0.0.1:6379
[root@centos7002 bin]#