//下载redis安装包 wget https://download.redis.io/releases/redis-6.2.2.tar.gz //解压到/opt/ [root@node1 opt]# tar zxvf redis-6.2.2.tar.gz -C /opt/ root@node1 opt]# ls anaconda-ks.cfg data redis-6.2.2 //下载编译工具 [root@node1 redis-6.2.2]# yum install -y gcc-c++ make //用make安装 [root@node1 redis-6.2.2]# make [root@node1 redis-6.2.2]# make ... ... ... Hint: It‘s a good idea to run ‘make test‘ ;) make[1]: Leaving directory ‘/opt/redis-6.2.2/src‘ [root@node1 redis-6.2.2]# make cd src && make all make[1]: Entering directory ‘/opt/redis-6.2.2/src‘ CC Makefile.dep Hint: It‘s a good idea to run ‘make test‘ ;) make[1]: Leaving directory ‘/opt/redis-6.2.2/src‘ [root@node1 redis-6.2.2]# make install cd src && make install make[1]: Entering directory ‘/opt/redis-6.2.2/src‘ Hint: It‘s a good idea to run ‘make test‘ ;) INSTALL redis-server INSTALL redis-benchmark INSTALL redis-cli make[1]: Leaving directory ‘/opt/redis-6.2.2/src‘
//redis的默认安装路径 [root@node1 bin]# ls redis-benchmark redis-check-rdb redis-sentinel zabbix_get zabbix_sender redis-check-aof redis-cli redis-server zabbix_js [root@node1 bin]# pwd /usr/local/bin //redis配置文件 [root@node1 bin]# mkdir redis_cp_conf [root@node1 bin]# ls redis-benchmark redis-check-rdb redis_cp_conf redis-server zabbix_js redis-check-aof redis-cli redis-sentinel zabbix_get zabbix_sender [root@node1 bin]# cp /opt/redis-6.2.2/redis.conf redis_cp_conf/ [root@node1 bin]# ls redis-benchmark redis-check-rdb redis_cp_conf redis-server zabbix_js redis-check-aof redis-cli redis-sentinel zabbix_get zabbix_sender [root@node1 bin]# cd redis_cp_conf/ [root@node1 redis_cp_conf]# ls redis.conf [root@node1 redis_cp_conf]# vim redis.conf ..... tcp-keepalive 300 ################################# TLS/SSL ##################################### daemonize yes //后台可以运行 ..... ..... //启动redis服务 [root@node1 bin]# redis-server redis_cp_conf/redis.conf [root@node1 bin]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 0.0.0.0:9000 0.0.0.0:* LISTEN 0 128 127.0.0.1:6379 0.0.0.0:*
//6379端口已经起来
LISTEN 0 128 [::]:22 [::]:* LISTEN 0 80 *:3306 *:* LISTEN 0 128 [::1]:6379 [::]:*
//使用redis客户端连接 [root@node1 bin]# redis-cli -p 6379 127.0.0.1:6379> ping PONG 127.0.0.1:6379> set name mei OK 127.0.0.1:6379> get name "mei" 127.0.0.1:6379> keys * //查看所有的key 1) "name" 127.0.0.1:6379> //关闭redis服务 127.0.0.1:6379> SHUTDOWN not connected> EXIT [root@node1 bin]# ss -antl State Recv-Q Send-Q Local Address:Port Peer Address:Port LISTEN 0 128 0.0.0.0:22 0.0.0.0:* LISTEN 0 128 0.0.0.0:9000 0.0.0.0:* LISTEN 0 128 [::]:22 [::]:* LISTEN 0 80 *:3306 *:*
‘
原文:https://www.cnblogs.com/meijianbiao/p/14690598.html