mv /home/bjtel/redis-6.2.5.tar.gz /app/
cd /app
ll
chown root:root redis-6.2.5.tar.gz
tar -zxvf redis-6.2.5.tar.gz
pwd
ll
pwd
mkdir redis6
gcc -v
cd redis-6.2.5/
ll
pwd
yum install tcl -y
cd /app
ll
cd redis-6.2.5/
ll
make
make install PREFIX=/app/redis6
cd /app/redis6
ll
cd bin
ll
cd /app/redis-6.2.5/
make test
pwd
cd /app/redis6
ll
mkdir data
ll bin
cp /app/redis-6.2.5/redis.conf ./bin/
ll bin
cd bin
vi redis.conf
#daemonize no 改为yes,开启后台运行,默认是前台运行 daemonize yes #把这一行注释,监听所有IP #bind 127.0.0.1 #protected-mode yes 如果改为no,则是关闭保护模式,这种模式下不能配置系统服务,建议还是开启 protected-mode yes #requirpass,保护模式开启的时候要配置密码或者bind ip requirepass 123456 #修改本参数,指定数据目录 dir /app/redis6/data #修改本参数,指定日志目录 logfile /app//redis6/redis_6379.log
cat redis.conf|grep -v grep|grep -v "^$"|grep -v "#" |sort
vi /lib/systemd/system/redis.service
[Unit] Description=Redis After=network.target [Service] Type=forking PIDFile=/var/run/redis_6379.pid ExecStart=/app/redis6/bin/redis-server /app/redis6/bin/redis.conf ExecReload=/bin/kill -s HUP $MAINPID ExecStop=/bin/kill -s QUIT $MAINPID PrivateTmp=true [Install] WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable redis
systemctl start redis
systemctl status redis
pwd
cd ..
ll
tail -f redis_6379.log
cat /proc/sys/net/core/somaxconn
sysctl -a|grep net.core.somaxconn
sysctl net.core.somaxconn=1024
sysctl vm.overcommit_memory=1
sysctl -p
vi /etc/sysctl.conf
vm.nr_hugepages = 20000 vm.swappiness = 10 net.core.somaxconn = 1024 vm.overcommit_memory = 1
sysctl -p
free -g
systemctl stop redis
systemctl start redis
ll
tail -f redis_6379.log
netstat -tunlp|grep LISTEN
pwd
ll /app
pwd
cd ..
ll
rm -rf redis-6.2.5
ll
df -h
cd /app/redis6/
ll
cd data
ll
cd ..
pwd
more redis_6379.log
systemctl stop redis
systemctl start redis
systemctl status redis
参考:
https://www.cnblogs.com/houchaoying/p/13031041.html