安装Redis
xuej@xuej-VirtualBox:~/Downloads$ wget https://download.redis.io/releases/redis-6.2.7.tar.gz
--2022-06-07 21:46:16-- https://download.redis.io/releases/redis-6.2.7.tar.gz
Resolving download.redis.io (download.redis.io)... 45.60.125.1
Connecting to download.redis.io (download.redis.io)|45.60.125.1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2487287 (2.4M) [application/octet-stream]
Saving to: ‘redis-6.2.7.tar.gz’
redis-6.2.7.tar.gz 100%[===============================================================================================================>] 2.37M 342KB/s in 6.6s
2022-06-07 21:46:24 (368 KB/s) - ‘redis-6.2.7.tar.gz’ saved [2487287/2487287]
xuej@xuej-VirtualBox:~/Downloads$ tar -xzvf redis-6.2.7.tar.gz
xuej@xuej-VirtualBox:~/Downloads$ cd redis-6.2.7/
xuej@xuej-VirtualBox:~/Downloads/redis-6.2.7$ make
xuej@xuej-VirtualBox:~/Downloads/redis-6.2.7$ sudo apt install tcl
[sudo] password for xuej:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
fonts-liberation2 fonts-opensymbol gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gudev-1.0 gir1.2-udisks-2.0 grilo-plugins-0.3-base gstreamer1.0-gtk3 libboost-date-time1.65.1
libboost-filesystem1.65.1 libboost-iostreams1.65.1 libboost-locale1.65.1 libcdr-0.1-1 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libdazzle-1.0-0 libe-book-0.1-1
libedataserverui-1.2-2 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libevent-2.1-6 libexiv2-14 libfreerdp-client2-2 libfreerdp2-2 libgc1c2 libgee-0.8-2 libgexiv2-2 libgom-1.0-0 libgpgmepp6
libgpod-common libgpod4 liblangtag-common liblangtag1 liblirc-client0 liblua5.3-0 libmediaart-2.0-0 libmspub-0.1-1 libodfgen-0.1-1 libqqwing2v5 libraw16 librevenge-0.0-0 libsgutils2-2 libssh-4
libsuitesparseconfig5 libvncclient1 libwinpr2-2 libxapian30 libxmlsec1 libxmlsec1-nss lp-solve media-player-info python3-mako python3-markupsafe syslinux syslinux-common syslinux-legacy
usb-creator-common
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libtcl8.6 tcl8.6
Suggested packages:
tcl-tclreadline
The following NEW packages will be installed:
libtcl8.6 tcl tcl8.6
0 upgraded, 3 newly installed, 0 to remove and 179 not upgraded.
Need to get 901 kB of archives.
After this operation, 4,080 kB of additional disk space will be used.
Do you want to continue? [Y/n]
Get:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 libtcl8.6 amd64 8.6.8+dfsg-3 [881 kB]
Get:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/main amd64 tcl8.6 amd64 8.6.8+dfsg-3 [14.4 kB]
Get:3 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic/universe amd64 tcl amd64 8.6.0+9 [5,146 B]
Fetched 901 kB in 2s (564 kB/s)
Selecting previously unselected package libtcl8.6:amd64.
(Reading database ... 124495 files and directories currently installed.)
Preparing to unpack .../libtcl8.6_8.6.8+dfsg-3_amd64.deb ...
Unpacking libtcl8.6:amd64 (8.6.8+dfsg-3) ...
Selecting previously unselected package tcl8.6.
Preparing to unpack .../tcl8.6_8.6.8+dfsg-3_amd64.deb ...
Unpacking tcl8.6 (8.6.8+dfsg-3) ...
Selecting previously unselected package tcl.
Preparing to unpack .../archives/tcl_8.6.0+9_amd64.deb ...
Unpacking tcl (8.6.0+9) ...
Setting up libtcl8.6:amd64 (8.6.8+dfsg-3) ...
Setting up tcl8.6 (8.6.8+dfsg-3) ...
Setting up tcl (8.6.0+9) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1.4) ...
xuej@xuej-VirtualBox:~/Downloads/redis-6.2.7$ make test
xuej@xuej-VirtualBox:~/Downloads/redis-6.2.7$ sudo make install
cd src && make install
make[1]: Entering directory '/home/xuej/Downloads/redis-6.2.7/src'
Hint: It's a good idea to run 'make test' ;)
INSTALL redis-server
INSTALL redis-benchmark
INSTALL redis-cli
make[1]: Leaving directory '/home/xuej/Downloads/redis-6.2.7/src'
xuej@xuej-VirtualBox:~/Downloads/redis-6.2.7$ redis-server
22185:C 07 Jun 2022 22:36:23.971 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
22185:C 07 Jun 2022 22:36:23.971 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=22185, just started
22185:C 07 Jun 2022 22:36:23.971 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
22185:M 07 Jun 2022 22:36:23.971 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
22185:M 07 Jun 2022 22:36:23.971 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
22185:M 07 Jun 2022 22:36:23.971 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
22185:M 07 Jun 2022 22:36:23.971 * monotonic clock: POSIX clock_gettime
22185:M 07 Jun 2022 22:36:23.971 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 22185
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
22185:M 07 Jun 2022 22:36:23.972 # Server initialized
22185:M 07 Jun 2022 22:36:23.972 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
22185:M 07 Jun 2022 22:36:23.972 * Ready to accept connections
22185:M 07 Jun 2022 22:37:24.026 * 10000 changes in 60 seconds. Saving...
22185:M 07 Jun 2022 22:37:24.027 * Background saving started by pid 22213
22213:C 07 Jun 2022 22:37:24.036 * DB saved on disk
22213:C 07 Jun 2022 22:37:24.036 * RDB: 0 MB of memory used by copy-on-write
22185:M 07 Jun 2022 22:37:24.128 * Background saving terminated with success
22185:signal-handler (1654612702) Received SIGINT scheduling shutdown...
22185:M 07 Jun 2022 22:38:22.293 # User requested shutdown...
22185:M 07 Jun 2022 22:38:22.293 * Saving the final RDB snapshot before exiting.
22185:M 07 Jun 2022 22:38:22.302 * DB saved on disk
22185:M 07 Jun 2022 22:38:22.302 # Redis is now ready to exit, bye bye...
部署Redis Sentinel
利用Sentinel使得单节点具有高可用的特性!
启动3个Redis Server实例
xuej@xuej-VirtualBox:~$ redis-server --port 6379
7494:C 28 May 2022 23:23:19.178 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7494:C 28 May 2022 23:23:19.178 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=7494, just started
7494:C 28 May 2022 23:23:19.178 # Configuration loaded
7494:M 28 May 2022 23:23:19.179 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
7494:M 28 May 2022 23:23:19.179 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
7494:M 28 May 2022 23:23:19.179 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
7494:M 28 May 2022 23:23:19.179 * monotonic clock: POSIX clock_gettime
7494:M 28 May 2022 23:23:19.179 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 7494
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
7494:M 28 May 2022 23:23:19.179 # Server initialized
7494:M 28 May 2022 23:23:19.179 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7494:M 28 May 2022 23:23:19.179 * Loading RDB produced by version 6.2.7
7494:M 28 May 2022 23:23:19.179 * RDB age 427 seconds
7494:M 28 May 2022 23:23:19.179 * RDB memory usage when created 2.42 Mb
7494:M 28 May 2022 23:23:19.180 # Done loading RDB, keys loaded: 9, keys expired: 0.
7494:M 28 May 2022 23:23:19.180 * DB loaded from disk: 0.001 seconds
7494:M 28 May 2022 23:23:19.180 * Ready to accept connections
7494:M 28 May 2022 23:23:22.683 * Replica 127.0.0.1:6380 asks for synchronization
7494:M 28 May 2022 23:23:22.683 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '62f2e7543962e4ded68d748d55a47932f5b60cde', my replication IDs are '74831be17f383fc5cb5f12ad00ecca1f3ab79ac9' and '0000000000000000000000000000000000000000')
7494:M 28 May 2022 23:23:22.683 * Replication backlog created, my new replication IDs are '429022deaf1b0b79add55aa3c8a01bd8775681bb' and '0000000000000000000000000000000000000000'
7494:M 28 May 2022 23:23:22.683 * Starting BGSAVE for SYNC with target: disk
7494:M 28 May 2022 23:23:22.683 * Background saving started by pid 7504
7504:C 28 May 2022 23:23:22.687 * DB saved on disk
7504:C 28 May 2022 23:23:22.687 * RDB: 0 MB of memory used by copy-on-write
7494:M 28 May 2022 23:23:22.747 * Background saving terminated with success
7494:M 28 May 2022 23:23:22.747 * Synchronization with replica 127.0.0.1:6380 succeeded
xuej@xuej-VirtualBox:~$ redis-server --port 6380 --replicaof 127.0.0.1 6379 --replica-read-only no
7500:C 28 May 2022 23:23:22.679 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7500:C 28 May 2022 23:23:22.679 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=7500, just started
7500:C 28 May 2022 23:23:22.679 # Configuration loaded
7500:S 28 May 2022 23:23:22.680 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
7500:S 28 May 2022 23:23:22.680 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
7500:S 28 May 2022 23:23:22.680 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
7500:S 28 May 2022 23:23:22.680 * monotonic clock: POSIX clock_gettime
7500:S 28 May 2022 23:23:22.681 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6380
| `-._ `._ / _.-' | PID: 7500
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
7500:S 28 May 2022 23:23:22.681 # Server initialized
7500:S 28 May 2022 23:23:22.681 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7500:S 28 May 2022 23:23:22.681 * Loading RDB produced by version 6.2.7
7500:S 28 May 2022 23:23:22.681 * RDB age 430 seconds
7500:S 28 May 2022 23:23:22.681 * RDB memory usage when created 2.42 Mb
7500:S 28 May 2022 23:23:22.681 # Done loading RDB, keys loaded: 9, keys expired: 0.
7500:S 28 May 2022 23:23:22.681 * DB loaded from disk: 0.000 seconds
7500:S 28 May 2022 23:23:22.681 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
7500:S 28 May 2022 23:23:22.681 * Ready to accept connections
7500:S 28 May 2022 23:23:22.683 * Connecting to MASTER 127.0.0.1:6379
7500:S 28 May 2022 23:23:22.683 * MASTER <-> REPLICA sync started
7500:S 28 May 2022 23:23:22.683 * Non blocking connect for SYNC fired the event.
7500:S 28 May 2022 23:23:22.683 * Master replied to PING, replication can continue...
7500:S 28 May 2022 23:23:22.683 * Trying a partial resynchronization (request 62f2e7543962e4ded68d748d55a47932f5b60cde:32863).
7500:S 28 May 2022 23:23:22.684 * Full resync from master: 429022deaf1b0b79add55aa3c8a01bd8775681bb:0
7500:S 28 May 2022 23:23:22.684 * Discarding previously cached master state.
7500:S 28 May 2022 23:23:22.747 * MASTER <-> REPLICA sync: receiving 12234 bytes from master to disk
7500:S 28 May 2022 23:23:22.747 * MASTER <-> REPLICA sync: Flushing old data
7500:S 28 May 2022 23:23:22.747 * MASTER <-> REPLICA sync: Loading DB in memory
7500:S 28 May 2022 23:23:22.750 * Loading RDB produced by version 6.2.7
7500:S 28 May 2022 23:23:22.750 * RDB age 0 seconds
7500:S 28 May 2022 23:23:22.750 * RDB memory usage when created 2.24 Mb
7500:S 28 May 2022 23:23:22.750 # Done loading RDB, keys loaded: 9, keys expired: 0.
7500:S 28 May 2022 23:23:22.750 * MASTER <-> REPLICA sync: Finished with success
xuej@xuej-VirtualBox:~$ redis-server --port 6381 --replicaof 127.0.0.1 6379 --replica-read-only no
7579:C 28 May 2022 23:24:55.084 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7579:C 28 May 2022 23:24:55.084 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=7579, just started
7579:C 28 May 2022 23:24:55.084 # Configuration loaded
7579:S 28 May 2022 23:24:55.085 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
7579:S 28 May 2022 23:24:55.085 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
7579:S 28 May 2022 23:24:55.085 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
7579:S 28 May 2022 23:24:55.085 * monotonic clock: POSIX clock_gettime
7579:S 28 May 2022 23:24:55.085 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6381
| `-._ `._ / _.-' | PID: 7579
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
7579:S 28 May 2022 23:24:55.085 # Server initialized
7579:S 28 May 2022 23:24:55.085 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7579:S 28 May 2022 23:24:55.085 * Loading RDB produced by version 6.2.7
7579:S 28 May 2022 23:24:55.085 * RDB age 93 seconds
7579:S 28 May 2022 23:24:55.085 * RDB memory usage when created 2.24 Mb
7579:S 28 May 2022 23:24:55.086 # Done loading RDB, keys loaded: 9, keys expired: 0.
7579:S 28 May 2022 23:24:55.086 * DB loaded from disk: 0.001 seconds
7579:S 28 May 2022 23:24:55.086 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
7579:S 28 May 2022 23:24:55.086 * Ready to accept connections
7579:S 28 May 2022 23:24:55.087 * Connecting to MASTER 127.0.0.1:6379
7579:S 28 May 2022 23:24:55.087 * MASTER <-> REPLICA sync started
7579:S 28 May 2022 23:24:55.087 * Non blocking connect for SYNC fired the event.
7579:S 28 May 2022 23:24:55.087 * Master replied to PING, replication can continue...
7579:S 28 May 2022 23:24:55.088 * Trying a partial resynchronization (request 429022deaf1b0b79add55aa3c8a01bd8775681bb:1).
7579:S 28 May 2022 23:24:55.088 * Successful partial resynchronization with master.
7579:S 28 May 2022 23:24:55.088 * MASTER <-> REPLICA sync: Master accepted a Partial Resynchronization.
启动3个Redis Sentinel实例
xuej@xuej-VirtualBox:~/redis$ vim sentinel0.conf
port 26379
sentinel monitor mymaster 127.0.0.1 6380 2
sentinel down-after-milliseconds mymaster 3000
xuej@xuej-VirtualBox:~/redis$ vim sentinel1.conf
port 26380
sentinel monitor mymaster 127.0.0.1 6380 2
sentinel down-after-milliseconds mymaster 3000
xuej@xuej-VirtualBox:~/redis$ vim sentinel2.conf
port 26381
sentinel monitor mymaster 127.0.0.1 6380 2
sentinel down-after-milliseconds mymaster 3000
xuej@xuej-VirtualBox:~/redis$ redis-sentinel sentinel0.conf
7761:X 28 May 2022 23:27:57.286 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7761:X 28 May 2022 23:27:57.286 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=7761, just started
7761:X 28 May 2022 23:27:57.286 # Configuration loaded
7761:X 28 May 2022 23:27:57.286 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
7761:X 28 May 2022 23:27:57.286 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
7761:X 28 May 2022 23:27:57.286 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
7761:X 28 May 2022 23:27:57.286 * monotonic clock: POSIX clock_gettime
7761:X 28 May 2022 23:27:57.287 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in sentinel mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 26379
| `-._ `._ / _.-' | PID: 7761
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
7761:X 28 May 2022 23:27:57.296 # Sentinel ID is f29154232a132950dc77935faa83464d7b97ca98
7761:X 28 May 2022 23:27:57.296 # +monitor master mymaster 127.0.0.1 6380 quorum 2
7761:X 28 May 2022 23:28:12.452 * +sentinel sentinel 6587fb8395b95d2520daa05ce4f49f86abecd05d 127.0.0.1 26380 @ mymaster 127.0.0.1 6380
7761:X 28 May 2022 23:28:20.302 # +sdown master mymaster 127.0.0.1 6380
7761:X 28 May 2022 23:28:26.950 * +sentinel sentinel a786e7e043f077b2c557d3553b2a11d8ea25f6f2 127.0.0.1 26381 @ mymaster 127.0.0.1 6380
7761:X 28 May 2022 23:28:33.548 # +new-epoch 1
7761:X 28 May 2022 23:28:33.553 # +vote-for-leader 6587fb8395b95d2520daa05ce4f49f86abecd05d 1
7761:X 28 May 2022 23:28:33.825 # +odown master mymaster 127.0.0.1 6380 #quorum 2/2
7761:X 28 May 2022 23:28:33.825 # Next failover delay: I will not start a failover before Sat May 28 23:34:34 2022
xuej@xuej-VirtualBox:~/redis$ redis-sentinel sentinel1.conf
7811:X 28 May 2022 23:28:10.423 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7811:X 28 May 2022 23:28:10.423 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=7811, just started
7811:X 28 May 2022 23:28:10.423 # Configuration loaded
7811:X 28 May 2022 23:28:10.424 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
7811:X 28 May 2022 23:28:10.424 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
7811:X 28 May 2022 23:28:10.424 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
7811:X 28 May 2022 23:28:10.424 * monotonic clock: POSIX clock_gettime
7811:X 28 May 2022 23:28:10.424 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in sentinel mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 26380
| `-._ `._ / _.-' | PID: 7811
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
7811:X 28 May 2022 23:28:10.427 # Sentinel ID is 6587fb8395b95d2520daa05ce4f49f86abecd05d
7811:X 28 May 2022 23:28:10.427 # +monitor master mymaster 127.0.0.1 6380 quorum 2
7811:X 28 May 2022 23:28:11.648 * +sentinel sentinel f29154232a132950dc77935faa83464d7b97ca98 127.0.0.1 26379 @ mymaster 127.0.0.1 6380
7811:X 28 May 2022 23:28:26.950 * +sentinel sentinel a786e7e043f077b2c557d3553b2a11d8ea25f6f2 127.0.0.1 26381 @ mymaster 127.0.0.1 6380
7811:X 28 May 2022 23:28:33.451 # +sdown master mymaster 127.0.0.1 6380
7811:X 28 May 2022 23:28:33.528 # +odown master mymaster 127.0.0.1 6380 #quorum 2/2
7811:X 28 May 2022 23:28:33.529 # +new-epoch 1
7811:X 28 May 2022 23:28:33.529 # +try-failover master mymaster 127.0.0.1 6380
7811:X 28 May 2022 23:28:33.538 # +vote-for-leader 6587fb8395b95d2520daa05ce4f49f86abecd05d 1
7811:X 28 May 2022 23:28:33.553 # f29154232a132950dc77935faa83464d7b97ca98 voted for 6587fb8395b95d2520daa05ce4f49f86abecd05d 1
7811:X 28 May 2022 23:28:33.553 # a786e7e043f077b2c557d3553b2a11d8ea25f6f2 voted for 6587fb8395b95d2520daa05ce4f49f86abecd05d 1
7811:X 28 May 2022 23:28:33.615 # +elected-leader master mymaster 127.0.0.1 6380
7811:X 28 May 2022 23:28:33.615 # +failover-state-select-slave master mymaster 127.0.0.1 6380
7811:X 28 May 2022 23:28:33.673 # -failover-abort-no-good-slave master mymaster 127.0.0.1 6380
7811:X 28 May 2022 23:28:33.732 # Next failover delay: I will not start a failover before Sat May 28 23:34:33 2022
xuej@xuej-VirtualBox:~/redis$ redis-sentinel sentinel2.conf
7817:X 28 May 2022 23:28:24.904 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7817:X 28 May 2022 23:28:24.904 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=7817, just started
7817:X 28 May 2022 23:28:24.904 # Configuration loaded
7817:X 28 May 2022 23:28:24.904 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
7817:X 28 May 2022 23:28:24.904 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
7817:X 28 May 2022 23:28:24.904 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
7817:X 28 May 2022 23:28:24.904 * monotonic clock: POSIX clock_gettime
7817:X 28 May 2022 23:28:24.905 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in sentinel mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 26381
| `-._ `._ / _.-' | PID: 7817
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
7817:X 28 May 2022 23:28:24.914 # Sentinel ID is a786e7e043f077b2c557d3553b2a11d8ea25f6f2
7817:X 28 May 2022 23:28:24.914 # +monitor master mymaster 127.0.0.1 6380 quorum 2
7817:X 28 May 2022 23:28:25.896 * +sentinel sentinel f29154232a132950dc77935faa83464d7b97ca98 127.0.0.1 26379 @ mymaster 127.0.0.1 6380
7817:X 28 May 2022 23:28:26.609 * +sentinel sentinel 6587fb8395b95d2520daa05ce4f49f86abecd05d 127.0.0.1 26380 @ mymaster 127.0.0.1 6380
7817:X 28 May 2022 23:28:33.548 # +new-epoch 1
7817:X 28 May 2022 23:28:33.553 # +vote-for-leader 6587fb8395b95d2520daa05ce4f49f86abecd05d 1
7817:X 28 May 2022 23:28:47.961 # +sdown master mymaster 127.0.0.1 6380
7817:X 28 May 2022 23:28:48.015 # +odown master mymaster 127.0.0.1 6380 #quorum 3/2
7817:X 28 May 2022 23:28:48.015 # Next failover delay: I will not start a failover before Sat May 28 23:34:33 2022
查看Redis Server状态
xuej@xuej-VirtualBox:~/redis$ redis-cli -p 6379
127.0.0.1:6379> INFO replication
# Replication
role:master
connected_slaves:2
slave0:ip=127.0.0.1,port=6380,state=online,offset=560,lag=1
slave1:ip=127.0.0.1,port=6381,state=online,offset=560,lag=0
master_failover_state:no-failover
master_replid:429022deaf1b0b79add55aa3c8a01bd8775681bb
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:560
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:560
127.0.0.1:6379>
xuej@xuej-VirtualBox:~/redis$ redis-cli -p 6380
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_read_repl_offset:560
slave_repl_offset:560
slave_priority:100
slave_read_only:1
replica_announced:1
connected_slaves:0
master_failover_state:no-failover
master_replid:429022deaf1b0b79add55aa3c8a01bd8775681bb
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:560
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:560
127.0.0.1:6380>
xuej@xuej-VirtualBox:~/redis$ redis-cli -p 6381
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:9
master_sync_in_progress:0
slave_read_repl_offset:560
slave_repl_offset:560
slave_priority:100
slave_read_only:1
replica_announced:1
connected_slaves:0
master_failover_state:no-failover
master_replid:429022deaf1b0b79add55aa3c8a01bd8775681bb
master_replid2:0000000000000000000000000000000000000000
master_repl_offset:560
second_repl_offset:-1
repl_backlog_active:1
repl_backlog_size:1048576
repl_backlog_first_byte_offset:1
repl_backlog_histlen:560
127.0.0.1:6381>
部署Redis Cluster
xuej@xuej-VirtualBox:~/redis/cluster-test$ vim 7000/redis.conf
port 7000
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
xuej@xuej-VirtualBox:~/redis/cluster-test$ vim 7001/redis.conf
port 7001
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
xuej@xuej-VirtualBox:~/redis/cluster-test$ vim 7002/redis.conf
port 7002
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
xuej@xuej-VirtualBox:~/redis/cluster-test$ vim 7003/redis.conf
port 7003
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
xuej@xuej-VirtualBox:~/redis/cluster-test$ vim 7004/redis.conf
port 7004
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
xuej@xuej-VirtualBox:~/redis/cluster-test$ vim 7005/redis.conf
port 7005
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
appendonly yes
xuej@xuej-VirtualBox:~/redis/cluster-test/7000$ redis-server redis.conf
13691:C 29 May 2022 00:56:15.838 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13691:C 29 May 2022 00:56:15.838 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=13691, just started
13691:C 29 May 2022 00:56:15.838 # Configuration loaded
13691:M 29 May 2022 00:56:15.839 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
13691:M 29 May 2022 00:56:15.839 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
13691:M 29 May 2022 00:56:15.839 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
13691:M 29 May 2022 00:56:15.839 * monotonic clock: POSIX clock_gettime
13691:M 29 May 2022 00:56:15.839 * Node configuration loaded, I'm b4a042e5dc72dbd3e469e30dbc036af1f20e3530
13691:M 29 May 2022 00:56:15.840 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in cluster mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 7000
| `-._ `._ / _.-' | PID: 13691
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
13691:M 29 May 2022 00:56:15.840 # Server initialized
13691:M 29 May 2022 00:56:15.840 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13691:M 29 May 2022 00:56:15.840 * Ready to accept connections
13691:M 29 May 2022 00:57:32.694 # configEpoch set to 1 via CLUSTER SET-CONFIG-EPOCH
13691:M 29 May 2022 00:57:32.696 # IP address for this node updated to 127.0.0.1
13691:M 29 May 2022 00:57:34.702 * Replica 127.0.0.1:7004 asks for synchronization
13691:M 29 May 2022 00:57:34.702 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '244ff35699e6fbb9d16a6513e8021bc7a6540714', my replication IDs are 'f6d33625823a191d94fa459c54cd5fd72b6f77de' and '0000000000000000000000000000000000000000')
13691:M 29 May 2022 00:57:34.702 * Replication backlog created, my new replication IDs are '4f6da2ed065a6d34af76c89894fd0074ea1be729' and '0000000000000000000000000000000000000000'
13691:M 29 May 2022 00:57:34.702 * Starting BGSAVE for SYNC with target: disk
13691:M 29 May 2022 00:57:34.702 * Background saving started by pid 13822
13822:C 29 May 2022 00:57:34.712 * DB saved on disk
13822:C 29 May 2022 00:57:34.712 * RDB: 0 MB of memory used by copy-on-write
13691:M 29 May 2022 00:57:34.728 * Background saving terminated with success
13691:M 29 May 2022 00:57:34.728 * Synchronization with replica 127.0.0.1:7004 succeeded
13691:M 29 May 2022 00:57:37.681 # Cluster state changed: ok
xuej@xuej-VirtualBox:~/redis/cluster-test/7001$ redis-server redis.conf
13698:C 29 May 2022 00:56:31.399 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13698:C 29 May 2022 00:56:31.399 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=13698, just started
13698:C 29 May 2022 00:56:31.399 # Configuration loaded
13698:M 29 May 2022 00:56:31.400 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
13698:M 29 May 2022 00:56:31.400 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
13698:M 29 May 2022 00:56:31.400 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
13698:M 29 May 2022 00:56:31.400 * monotonic clock: POSIX clock_gettime
13698:M 29 May 2022 00:56:31.400 * Node configuration loaded, I'm cf28c098246bc405e68affb33067dc458213f99a
13698:M 29 May 2022 00:56:31.400 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in cluster mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 7001
| `-._ `._ / _.-' | PID: 13698
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
13698:M 29 May 2022 00:56:31.401 # Server initialized
13698:M 29 May 2022 00:56:31.401 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13698:M 29 May 2022 00:56:31.401 * Ready to accept connections
13698:M 29 May 2022 00:57:32.694 # configEpoch set to 2 via CLUSTER SET-CONFIG-EPOCH
13698:M 29 May 2022 00:57:32.696 # IP address for this node updated to 127.0.0.1
13698:M 29 May 2022 00:57:34.702 * Replica 127.0.0.1:7005 asks for synchronization
13698:M 29 May 2022 00:57:34.702 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for '2afedbb8a03d61a1d42eccef16defce60cd824f1', my replication IDs are '879e5a90bf755c03d2af9506995195c257c56ace' and '0000000000000000000000000000000000000000')
13698:M 29 May 2022 00:57:34.702 * Replication backlog created, my new replication IDs are '18eaceaf66b3dba40d34f47a59ef1cf613c40beb' and '0000000000000000000000000000000000000000'
13698:M 29 May 2022 00:57:34.702 * Starting BGSAVE for SYNC with target: disk
13698:M 29 May 2022 00:57:34.702 * Background saving started by pid 13823
13823:C 29 May 2022 00:57:34.712 * DB saved on disk
13823:C 29 May 2022 00:57:34.712 * RDB: 0 MB of memory used by copy-on-write
13698:M 29 May 2022 00:57:34.728 * Background saving terminated with success
13698:M 29 May 2022 00:57:34.728 * Synchronization with replica 127.0.0.1:7005 succeeded
13698:M 29 May 2022 00:57:37.681 # Cluster state changed: ok
xuej@xuej-VirtualBox:~/redis/cluster-test/7002$ redis-server redis.conf
13573:C 29 May 2022 00:55:30.675 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13573:C 29 May 2022 00:55:30.675 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=13573, just started
13573:C 29 May 2022 00:55:30.675 # Configuration loaded
13573:M 29 May 2022 00:55:30.675 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
13573:M 29 May 2022 00:55:30.676 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
13573:M 29 May 2022 00:55:30.676 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
13573:M 29 May 2022 00:55:30.676 * monotonic clock: POSIX clock_gettime
13573:M 29 May 2022 00:55:30.676 * No cluster configuration found, I'm d5488363734c02aba9bba484542b41de70335703
13573:M 29 May 2022 00:55:30.678 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in cluster mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 7002
| `-._ `._ / _.-' | PID: 13573
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
13573:M 29 May 2022 00:55:30.678 # Server initialized
13573:M 29 May 2022 00:55:30.678 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13573:M 29 May 2022 00:55:30.678 * Ready to accept connections
13573:M 29 May 2022 00:57:32.695 # configEpoch set to 3 via CLUSTER SET-CONFIG-EPOCH
13573:M 29 May 2022 00:57:32.797 # IP address for this node updated to 127.0.0.1
13573:M 29 May 2022 00:57:34.701 * Replica 127.0.0.1:7003 asks for synchronization
13573:M 29 May 2022 00:57:34.701 * Partial resynchronization not accepted: Replication ID mismatch (Replica asked for 'b5b6465a8d30ce8f208587d8b9373ae880b2ad5d', my replication IDs are 'be011267a00ab47145aa79e3863d7e4ae059fbbc' and '0000000000000000000000000000000000000000')
13573:M 29 May 2022 00:57:34.701 * Replication backlog created, my new replication IDs are 'e4e5dd2b66e66f9735eb4dd2c04ba4009ff0f192' and '0000000000000000000000000000000000000000'
13573:M 29 May 2022 00:57:34.701 * Starting BGSAVE for SYNC with target: disk
13573:M 29 May 2022 00:57:34.701 * Background saving started by pid 13821
13821:C 29 May 2022 00:57:34.710 * DB saved on disk
13821:C 29 May 2022 00:57:34.711 * RDB: 0 MB of memory used by copy-on-write
13573:M 29 May 2022 00:57:34.719 * Background saving terminated with success
13573:M 29 May 2022 00:57:34.719 * Synchronization with replica 127.0.0.1:7003 succeeded
13573:M 29 May 2022 00:57:37.754 # Cluster state changed: ok
xuej@xuej-VirtualBox:~/redis/cluster-test/7003$ redis-server redis.conf
13634:C 29 May 2022 00:55:41.412 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13634:C 29 May 2022 00:55:41.412 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=13634, just started
13634:C 29 May 2022 00:55:41.412 # Configuration loaded
13634:M 29 May 2022 00:55:41.412 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
13634:M 29 May 2022 00:55:41.412 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
13634:M 29 May 2022 00:55:41.412 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
13634:M 29 May 2022 00:55:41.412 * monotonic clock: POSIX clock_gettime
13634:M 29 May 2022 00:55:41.413 * No cluster configuration found, I'm 5bb16c3404c00ab801017cec8a559b3e88f13322
13634:M 29 May 2022 00:55:41.421 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in cluster mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 7003
| `-._ `._ / _.-' | PID: 13634
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
13634:M 29 May 2022 00:55:41.421 # Server initialized
13634:M 29 May 2022 00:55:41.421 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13634:M 29 May 2022 00:55:41.421 * Ready to accept connections
13634:M 29 May 2022 00:57:32.695 # configEpoch set to 4 via CLUSTER SET-CONFIG-EPOCH
13634:M 29 May 2022 00:57:32.798 # IP address for this node updated to 127.0.0.1
13634:S 29 May 2022 00:57:34.700 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
13634:S 29 May 2022 00:57:34.700 * Connecting to MASTER 127.0.0.1:7002
13634:S 29 May 2022 00:57:34.700 * MASTER <-> REPLICA sync started
13634:S 29 May 2022 00:57:34.700 # Cluster state changed: ok
13634:S 29 May 2022 00:57:34.700 * Non blocking connect for SYNC fired the event.
13634:S 29 May 2022 00:57:34.700 * Master replied to PING, replication can continue...
13634:S 29 May 2022 00:57:34.701 * Trying a partial resynchronization (request b5b6465a8d30ce8f208587d8b9373ae880b2ad5d:1).
13634:S 29 May 2022 00:57:34.701 * Full resync from master: e4e5dd2b66e66f9735eb4dd2c04ba4009ff0f192:0
13634:S 29 May 2022 00:57:34.701 * Discarding previously cached master state.
13634:S 29 May 2022 00:57:34.719 * MASTER <-> REPLICA sync: receiving 175 bytes from master to disk
13634:S 29 May 2022 00:57:34.719 * MASTER <-> REPLICA sync: Flushing old data
13634:S 29 May 2022 00:57:34.719 * MASTER <-> REPLICA sync: Loading DB in memory
13634:S 29 May 2022 00:57:34.721 * Loading RDB produced by version 6.2.7
13634:S 29 May 2022 00:57:34.721 * RDB age 0 seconds
13634:S 29 May 2022 00:57:34.721 * RDB memory usage when created 2.23 Mb
13634:S 29 May 2022 00:57:34.721 # Done loading RDB, keys loaded: 0, keys expired: 0.
13634:S 29 May 2022 00:57:34.721 * MASTER <-> REPLICA sync: Finished with success
13634:S 29 May 2022 00:57:34.721 * Background append only file rewriting started by pid 13824
13634:S 29 May 2022 00:57:34.757 * AOF rewrite child asks to stop sending diffs.
13824:C 29 May 2022 00:57:34.757 * Parent agreed to stop sending diffs. Finalizing AOF...
13824:C 29 May 2022 00:57:34.757 * Concatenating 0.00 MB of AOF diff received from parent.
13824:C 29 May 2022 00:57:34.759 * SYNC append only file rewrite performed
13824:C 29 May 2022 00:57:34.759 * AOF rewrite: 0 MB of memory used by copy-on-write
13634:S 29 May 2022 00:57:34.826 * Background AOF rewrite terminated with success
13634:S 29 May 2022 00:57:34.826 * Residual parent diff successfully flushed to the rewritten AOF (0.00 MB)
13634:S 29 May 2022 00:57:34.826 * Background AOF rewrite finished successfully
xuej@xuej-VirtualBox:~/redis/cluster-test/7004$ redis-server redis.conf
13651:C 29 May 2022 00:55:50.602 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13651:C 29 May 2022 00:55:50.602 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=13651, just started
13651:C 29 May 2022 00:55:50.602 # Configuration loaded
13651:M 29 May 2022 00:55:50.603 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
13651:M 29 May 2022 00:55:50.603 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
13651:M 29 May 2022 00:55:50.603 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
13651:M 29 May 2022 00:55:50.603 * monotonic clock: POSIX clock_gettime
13651:M 29 May 2022 00:55:50.603 * No cluster configuration found, I'm 6b4504eb0b43eb3d55eb09f3141d7566a65d1474
13651:M 29 May 2022 00:55:50.605 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in cluster mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 7004
| `-._ `._ / _.-' | PID: 13651
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
13651:M 29 May 2022 00:55:50.605 # Server initialized
13651:M 29 May 2022 00:55:50.605 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13651:M 29 May 2022 00:55:50.605 * Ready to accept connections
13651:M 29 May 2022 00:57:32.695 # configEpoch set to 5 via CLUSTER SET-CONFIG-EPOCH
13651:M 29 May 2022 00:57:32.899 # IP address for this node updated to 127.0.0.1
13651:S 29 May 2022 00:57:34.700 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
13651:S 29 May 2022 00:57:34.700 * Connecting to MASTER 127.0.0.1:7000
13651:S 29 May 2022 00:57:34.700 * MASTER <-> REPLICA sync started
13651:S 29 May 2022 00:57:34.701 # Cluster state changed: ok
13651:S 29 May 2022 00:57:34.701 * Non blocking connect for SYNC fired the event.
13651:S 29 May 2022 00:57:34.701 * Master replied to PING, replication can continue...
13651:S 29 May 2022 00:57:34.701 * Trying a partial resynchronization (request 244ff35699e6fbb9d16a6513e8021bc7a6540714:1).
13651:S 29 May 2022 00:57:34.702 * Full resync from master: 4f6da2ed065a6d34af76c89894fd0074ea1be729:0
13651:S 29 May 2022 00:57:34.702 * Discarding previously cached master state.
13651:S 29 May 2022 00:57:34.728 * MASTER <-> REPLICA sync: receiving 175 bytes from master to disk
13651:S 29 May 2022 00:57:34.728 * MASTER <-> REPLICA sync: Flushing old data
13651:S 29 May 2022 00:57:34.729 * MASTER <-> REPLICA sync: Loading DB in memory
13651:S 29 May 2022 00:57:34.731 * Loading RDB produced by version 6.2.7
13651:S 29 May 2022 00:57:34.731 * RDB age 0 seconds
13651:S 29 May 2022 00:57:34.731 * RDB memory usage when created 2.22 Mb
13651:S 29 May 2022 00:57:34.731 # Done loading RDB, keys loaded: 0, keys expired: 0.
13651:S 29 May 2022 00:57:34.731 * MASTER <-> REPLICA sync: Finished with success
13651:S 29 May 2022 00:57:34.731 * Background append only file rewriting started by pid 13825
13651:S 29 May 2022 00:57:34.766 * AOF rewrite child asks to stop sending diffs.
13825:C 29 May 2022 00:57:34.766 * Parent agreed to stop sending diffs. Finalizing AOF...
13825:C 29 May 2022 00:57:34.766 * Concatenating 0.00 MB of AOF diff received from parent.
13825:C 29 May 2022 00:57:34.767 * SYNC append only file rewrite performed
13825:C 29 May 2022 00:57:34.767 * AOF rewrite: 0 MB of memory used by copy-on-write
13651:S 29 May 2022 00:57:34.833 * Background AOF rewrite terminated with success
13651:S 29 May 2022 00:57:34.833 * Residual parent diff successfully flushed to the rewritten AOF (0.00 MB)
13651:S 29 May 2022 00:57:34.833 * Background AOF rewrite finished successfully
xuej@xuej-VirtualBox:~/redis/cluster-test/7005$ redis-server redis.conf
13668:C 29 May 2022 00:56:02.168 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
13668:C 29 May 2022 00:56:02.168 # Redis version=6.2.7, bits=64, commit=00000000, modified=0, pid=13668, just started
13668:C 29 May 2022 00:56:02.168 # Configuration loaded
13668:M 29 May 2022 00:56:02.169 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
13668:M 29 May 2022 00:56:02.169 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
13668:M 29 May 2022 00:56:02.169 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
13668:M 29 May 2022 00:56:02.169 * monotonic clock: POSIX clock_gettime
13668:M 29 May 2022 00:56:02.169 * No cluster configuration found, I'm 70e2cdceb603c903bef095bad30e8fd4bf9dcb24
13668:M 29 May 2022 00:56:02.177 # A key '__redis__compare_helper' was added to Lua globals which is not on the globals allow list nor listed on the deny list.
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 6.2.7 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in cluster mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 7005
| `-._ `._ / _.-' | PID: 13668
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | https://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
13668:M 29 May 2022 00:56:02.177 # Server initialized
13668:M 29 May 2022 00:56:02.177 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
13668:M 29 May 2022 00:56:02.177 * Ready to accept connections
13668:M 29 May 2022 00:57:32.695 # configEpoch set to 6 via CLUSTER SET-CONFIG-EPOCH
13668:M 29 May 2022 00:57:32.797 # IP address for this node updated to 127.0.0.1
13668:S 29 May 2022 00:57:34.701 * Before turning into a replica, using my own master parameters to synthesize a cached master: I may be able to synchronize with the new master with just a partial transfer.
13668:S 29 May 2022 00:57:34.701 * Connecting to MASTER 127.0.0.1:7001
13668:S 29 May 2022 00:57:34.701 * MASTER <-> REPLICA sync started
13668:S 29 May 2022 00:57:34.701 # Cluster state changed: ok
13668:S 29 May 2022 00:57:34.701 * Non blocking connect for SYNC fired the event.
13668:S 29 May 2022 00:57:34.702 * Master replied to PING, replication can continue...
13668:S 29 May 2022 00:57:34.702 * Trying a partial resynchronization (request 2afedbb8a03d61a1d42eccef16defce60cd824f1:1).
13668:S 29 May 2022 00:57:34.702 * Full resync from master: 18eaceaf66b3dba40d34f47a59ef1cf613c40beb:0
13668:S 29 May 2022 00:57:34.702 * Discarding previously cached master state.
13668:S 29 May 2022 00:57:34.728 * MASTER <-> REPLICA sync: receiving 175 bytes from master to disk
13668:S 29 May 2022 00:57:34.729 * MASTER <-> REPLICA sync: Flushing old data
13668:S 29 May 2022 00:57:34.730 * MASTER <-> REPLICA sync: Loading DB in memory
13668:S 29 May 2022 00:57:34.731 * Loading RDB produced by version 6.2.7
13668:S 29 May 2022 00:57:34.731 * RDB age 0 seconds
13668:S 29 May 2022 00:57:34.731 * RDB memory usage when created 2.17 Mb
13668:S 29 May 2022 00:57:34.731 # Done loading RDB, keys loaded: 0, keys expired: 0.
13668:S 29 May 2022 00:57:34.731 * MASTER <-> REPLICA sync: Finished with success
13668:S 29 May 2022 00:57:34.731 * Background append only file rewriting started by pid 13826
13668:S 29 May 2022 00:57:34.773 * AOF rewrite child asks to stop sending diffs.
13826:C 29 May 2022 00:57:34.774 * Parent agreed to stop sending diffs. Finalizing AOF...
13826:C 29 May 2022 00:57:34.774 * Concatenating 0.00 MB of AOF diff received from parent.
13826:C 29 May 2022 00:57:34.774 * SYNC append only file rewrite performed
13826:C 29 May 2022 00:57:34.775 * AOF rewrite: 0 MB of memory used by copy-on-write
13668:S 29 May 2022 00:57:34.792 * Background AOF rewrite terminated with success
13668:S 29 May 2022 00:57:34.792 * Residual parent diff successfully flushed to the rewritten AOF (0.00 MB)
13668:S 29 May 2022 00:57:34.792 * Background AOF rewrite finished successfully
xuej@xuej-VirtualBox:~/redis/cluster-test$ redis-cli --cluster create 127.0.0.1:7000 127.0.0.1:7001 \
> 127.0.0.1:7002 127.0.0.1:7003 127.0.0.1:7004 127.0.0.1:7005 \
> --cluster-replicas 1
>>> Performing hash slots allocation on 6 nodes...
Master[0] -> Slots 0 - 5460
Master[1] -> Slots 5461 - 10922
Master[2] -> Slots 10923 - 16383
Adding replica 127.0.0.1:7004 to 127.0.0.1:7000
Adding replica 127.0.0.1:7005 to 127.0.0.1:7001
Adding replica 127.0.0.1:7003 to 127.0.0.1:7002
>>> Trying to optimize slaves allocation for anti-affinity
[WARNING] Some slaves are in the same host as their master
M: b4a042e5dc72dbd3e469e30dbc036af1f20e3530 127.0.0.1:7000
slots:[0-5460] (5461 slots) master
M: cf28c098246bc405e68affb33067dc458213f99a 127.0.0.1:7001
slots:[5461-10922] (5462 slots) master
M: d5488363734c02aba9bba484542b41de70335703 127.0.0.1:7002
slots:[10923-16383] (5461 slots) master
S: 5bb16c3404c00ab801017cec8a559b3e88f13322 127.0.0.1:7003
replicates d5488363734c02aba9bba484542b41de70335703
S: 6b4504eb0b43eb3d55eb09f3141d7566a65d1474 127.0.0.1:7004
replicates b4a042e5dc72dbd3e469e30dbc036af1f20e3530
S: 70e2cdceb603c903bef095bad30e8fd4bf9dcb24 127.0.0.1:7005
replicates cf28c098246bc405e68affb33067dc458213f99a
Can I set the above configuration? (type 'yes' to accept): yes
>>> Nodes configuration updated
>>> Assign a different config epoch to each node
>>> Sending CLUSTER MEET messages to join the cluster
Waiting for the cluster to join
.
>>> Performing Cluster Check (using node 127.0.0.1:7000)
M: b4a042e5dc72dbd3e469e30dbc036af1f20e3530 127.0.0.1:7000
slots:[0-5460] (5461 slots) master
1 additional replica(s)
S: 5bb16c3404c00ab801017cec8a559b3e88f13322 127.0.0.1:7003
slots: (0 slots) slave
replicates d5488363734c02aba9bba484542b41de70335703
S: 6b4504eb0b43eb3d55eb09f3141d7566a65d1474 127.0.0.1:7004
slots: (0 slots) slave
replicates b4a042e5dc72dbd3e469e30dbc036af1f20e3530
M: d5488363734c02aba9bba484542b41de70335703 127.0.0.1:7002
slots:[10923-16383] (5461 slots) master
1 additional replica(s)
M: cf28c098246bc405e68affb33067dc458213f99a 127.0.0.1:7001
slots:[5461-10922] (5462 slots) master
1 additional replica(s)
S: 70e2cdceb603c903bef095bad30e8fd4bf9dcb24 127.0.0.1:7005
slots: (0 slots) slave
replicates cf28c098246bc405e68affb33067dc458213f99a
[OK] All nodes agree about slots configuration.
>>> Check for open slots...
>>> Check slots coverage...
[OK] All 16384 slots covered.
xuej@xuej-VirtualBox:~/redis/cluster-test$ redis-cli -c -p 7000
127.0.0.1:7000> set foo bar
-> Redirected to slot [12182] located at 127.0.0.1:7002
OK
127.0.0.1:7002> set hello world
-> Redirected to slot [866] located at 127.0.0.1:7000
OK
127.0.0.1:7000> get foo
-> Redirected to slot [12182] located at 127.0.0.1:7002
"bar"
127.0.0.1:7002> get hello
-> Redirected to slot [866] located at 127.0.0.1:7000
"world"
127.0.0.1:7000>