[[email protected] ~]$ su
Password:
[[email protected] adminroot]# vim /etc/redis/6379.conf
/slaveof
n
slaveof 192.168.1.108 6379
masterauth mypassword123
:wq
[[email protected] adminroot]# redis-server /etc/redis/6379.conf &
Error condition on socket for SYNC: Connection refused
[[email protected] adminroot]#reboot
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
3421:S 22 May 01:13:55.426 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
3421:S 22 May 01:13:55.427 # Server started, Redis version 3.2.0
3421:S 22 May 01:13:55.427 # 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.
3421:S 22 May 01:13:55.428 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled
[[email protected] adminroot]# vim /etc/sysctl.conf
vm.overcommit_memory = 1
[[email protected] adminroot]# reboot
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.0 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 3386
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
3386:S 22 May 01:28:23.293 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
3386:S 22 May 01:28:23.293 # Server started, Redis version 3.2.0
3386:S 22 May 01:28:23.294 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
3386:S 22 May 01:28:23.295 * DB loaded from disk: 0.000 seconds
3386:S 22 May 01:28:23.295 * The server is now ready to accept connections on port 6379
[[email protected] adminroot]# echo never > /sys/kernel/mm/transparent_hugepage/enabled
[[email protected] adminroot]# vim /etc/rc.local
touch /var/lock/subsys/local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
[[email protected] adminroot]# echo 511 > /proc/sys/net/core/somaxconn
4590:S 22 May 01:48:29.024 * Connecting to MASTER 192.168.1.108:6379
4590:S 22 May 01:48:29.025 * MASTER <-> SLAVE sync started
4590:S 22 May 01:48:29.025 # Error condition on socket for SYNC: Connection refused
==============================================================================
bash-4.2$ su
密码:
[[email protected] latte]# redis-server /etc/redis/6379.conf &
[[email protected] latte]# redis-cli -h 127.0.0.1 -p 6379
127.0.0.1:6379> get name
"master"
127.0.0.1:6379> get age
"28"
[[email protected] latte]# redis-server /etc/redis/6380.conf &
17591:S 24 May 13:32:58.751 * DB loaded from disk: 0.000 seconds
17591:S 24 May 13:32:58.751 * The server is now ready to accept connections on port 6380
17591:S 24 May 13:32:58.751 * Connecting to MASTER 127.0.0.1:6379
17591:S 24 May 13:32:58.751 * MASTER <-> SLAVE sync started
17591:S 24 May 13:32:58.751 * Non blocking connect for SYNC fired the event.
17591:S 24 May 13:32:58.752 * Master replied to PING, replication can continue...
17591:S 24 May 13:32:58.752 * Partial resynchronization not possible (no cached master)
17591:S 24 May 13:32:58.754 * Full resync from master: e2ed64ea513418cdcc4cdefd7f0ef6711d9ef4ac:1
17591:S 24 May 13:32:59.141 * MASTER <-> SLAVE sync: receiving 40 bytes from master
17591:S 24 May 13:32:59.141 * MASTER <-> SLAVE sync: Flushing old data
17591:S 24 May 13:32:59.141 * MASTER <-> SLAVE sync: Loading DB in memory
17591:S 24 May 13:32:59.141 * MASTER <-> SLAVE sync: Finished with success
[[email protected] latte]# redis-cli -h 127.0.0.1 -p 6380
127.0.0.1:6380> keys *
1) "name"
2) "age"
127.0.0.1:6380> get name
"master"
127.0.0.1:6380> get age
"28"
127.0.0.1:6380>