Redis 5.05 Separate mode installation and configuration method
- 2020-08-22 23:00:18
- OfStack
Operating system Centos7
1. Download redis
wget http://download.redis.io/releases/redis-5.0.5.tar.gz
tar xzf redis-5.0.5.tar.gz
cd redis-5.0.5
make
2. Start the service
After the command is executed, you can start the Redis service
[root@zk02 redis]# src/redis-server
5265:C 23 Oct 2019 16:58:04.682 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5265:C 23 Oct 2019 16:58:04.682 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=5265, just started
5265:C 23 Oct 2019 16:58:04.682 # Warning: no config file specified, using the default config. In order to specify a config file use src/redis-server /path/to/redis.conf
5265:M 23 Oct 2019 16:58:04.683 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 5.0.5 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 5265
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
5265:M 23 Oct 2019 16:58:04.684 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
5265:M 23 Oct 2019 16:58:04.684 # Server initialized
5265:M 23 Oct 2019 16:58:04.684 # 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.
5265:M 23 Oct 2019 16:58:04.684 # 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.
5265:M 23 Oct 2019 16:58:04.684 * Ready to accept connections
3. Interact with redis through the built-in client
[root@zk02 redis]# src/redis-cli
127.0.0.1:6379> set foo bar
OK
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379>
The number of open files for the log can be set by the following command
ulimit -n 10032
ps: Take a look at the single node installation configuration of Redis 5.0.5
download
http://download.redis.io/releases/redis-5.0.5.tar.gz
Unpack the
tar -C /usr/local -xvf redis-5.0.5.tar.gz
Compile the installation
cd /usr/local/redis-5.0.5
make install
Install using make install, the default installation directory is
/usr/local/bin/
Redis configuration file
Copy the sample configuration file to
/etc/redis/639.conf
mkdir /etc/redis
cp /usr/local/redis-5.0.5/redis.conf /etc/redis/6379.conf
Turn off protection mode
protected-mode no
Open access to other hosts, comment out bind 127.0.0.1
bind 127.0.0.1
Change to background startup
daemonize yes
For logging, you need to create the directory /var/applogs/redis first
logfile "/var/applogs/redis/redis.log"
Data storage directory
mkdir -p /var/redis-data/
dir /var/redis-data
Set the password
requirepass xxxx
The Redis configuration boot service
Use Redis's built-in startup script
cp /root/share/deploy-ready/redis-5.0.5/utils/redis_init_script /etc/init.d/redisd
Configuration starts from startup
chkconfig redisd on
Set the boot to boot
chkconfig redisd on
Firewall development port 6379
firewall-cmd --permanent --add-port=6379/tcp
firewall-cmd --reload
Client connection Redis
redis-cli -h 192.168.43.197 -p 6379 -a xxxx