redis 5.0.12 install
redis 5.0.12 install
## check directory
ls -l /XXXXXXX
##create dir
mkdir -p /XXXXXXX/dataredis mkdir -p /XXXXXXX/soft
## create user
groupadd redis -g 2100 useradd -g redis -u 2100 redis usermod -aG redis redis chown -R redis:redis /XXXXXXX/dataredis
## system config
cat >> /etc/sysctl.conf <<eof vm.overcommit_memory=1 vm.swappiness=1 net.ipv4.tcp_max_syn_backlog = 1024 net.core.somaxconn = 1024 eof sysctl -p cat >> /etc/rc.local <<eof echo never > /sys/kernel/mm/transparent_hugepage/enabled eof cat /etc/rc.local cat >> /etc/security/limits.conf<<eof redis soft nproc 2047 redis hard nproc 16384 redis soft nofile 1024 redis hard nofile 65536 eof cat /etc/security/limits.conf
## download
mkdir -p /XXXXXXX/soft ;cd /XXXXXXX/soft curl -L -o redis-5.0.12.tar.gz http://10.112.6.253:9999/soft/redis/redis-5.0.12.tar.gz
tar -zxvf redis-5.0.12.tar.gz cd redis-5.0.12 yum install -y gcc make MALLOC=libc make install
## redis 服务自启动--没有路径,就用手动启动,如果有可以使用系统命令起服务。
cd /usr/lib/systemd/system cat >redis.service <<eof [Unit] Description=redis ##After=redis-sentinel [Service] Group=redis User=redis ExecStart=/usr/local/bin/redis-server /XXXXXXX/dataredis/redis.conf --daemonize no ExecStop=/usr/local/bin/redis-cli -h 127.0.0.1 -p 6379 -a 'redis!0okm9ijn' shutdown nosave Restart=always [Install] WantedBy=multi-user.target eof
## config parameter
cp /XXXXXXX/soft/redis-5.0.12/redis.conf /XXXXXXX/dataredis sed -i \ -e 's/bind 127.0.0.1/#bind 127.0.0.1/gi' \ -e 's/timeout 0/timeout 600/gi' \ -e 's/supervised no/supervised systemd/gi' \ -e 's#logfile ""#logfile "/XXXXXXX/dataredis/redis.log"#gi' \ -e 's#dir ./#dir /XXXXXXX/dataredis #gi' \ -e 's#dir ./#dir /XXXXXXX/dataredis #gi' \ -e 's/# masterauth <master-password>/masterauth PICCredis!0okm9ijn/gi' \ -e 's/# maxclients 10000/maxclients 10000/gi' \ -e 's/# maxclients 10000/maxclients 10000/gi' \ -e 's/# maxmemory <bytes>/maxmemory 4G/gi' \ -e 's/# requirepass foobared/requirepass PICCredis!0okm9ijn/gi' \ /XXXXXXX/dataredis/redis.conf
cat /XXXXXXX/dataredis/redis.conf | grep -v ^# | grep -v ^$ chown -R redis:redis /XXXXXXX/dataredis chmod -R 775 /XXXXXXX/dataredis
##服务启动
##systemctl enable redis
systemctl enable redis
##systemctl start redis
systemctl start redis
##systemctl restart redis
systemctl restart redis
##or 手工启动
which redis-server /usr/local/bin/redis-server /XXXXXXX/dataredis/redis.conf &
[root@host01 dataredis]# more redis.log
10916:C 17 Jun 2021 06:59:45.486 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 10916:C 17 Jun 2021 06:59:45.486 # Redis version=5.0.12, bits=64, commit=00000000, modified=0, pid=10916, just started 10916:C 17 Jun 2021 06:59:45.486 # Configuration loaded 10916:C 17 Jun 2021 06:59:45.486 # systemd supervision requested, but NOTIFY_SOCKET not found 10916:M 17 Jun 2021 06:59:45.488 * Increased maximum number of open files to 10032 (it was originally set to 1024). _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 5.0.12 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 10916 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | http://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-' 10916:M 17 Jun 2021 06:59:45.489 # Server initialized 10916:M 17 Jun 2021 06:59:45.489 # 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. 10916:M 17 Jun 2021 06:59:45.489 * Ready to accept connections
##login
redis-cli
Nothing is trivial at all;

浙公网安备 33010602011771号