Linux安装redis
1、下载安装包! redis-5.0.8.tar.gz
2、解压Redis的安装包! 程序/opt
3、进入解压后的文件,可以看到我们redis的配置文件
[root@great-walk-2 opt]# ls
redis-5.0.7 redis-5.0.7.tar.gz
[root@great-walk-2 opt]# tar zxvf redis-5.0.7.tar.gz
4、基本的环境安装
yum install gcc-c++
make
make install
5、redis的默认安装路径 /usr/local/bin
[root@great-walk-2 opt]# cd /usr/local/bin/
[root@great-walk-2 bin]# ls
dump.rdb redis-benchmark redis-check-rdb redis-sentinel
kconfig redis-check-aof redis-cli redis-server
[root@great-walk-2 bin]#
6、将redis配置文件。复制到我们当前目录下
[root@great-walk-2 bin]# cp /opt/redis-5.0.7/redis.conf kconfig/
7、redis默认不是后台启动的,修改配置文件!
修改 daemonize yes
8、启动Redis服务!
[root@great-walk-2 bin]# redis-server kconfig/redis.conf
1046:C 13 Mar 2021 11:50:15.708 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1046:C 13 Mar 2021 11:50:15.708 # Redis version=5.0.7, bits=64, commit=00000000, modified=0, pid=1046, just started
1046:C 13 Mar 2021 11:50:15.708 # Configuration loaded
9、使用redis-cli 进行连接测试!
[root@great-walk-2 bin]# redis-cli -p 6379
127.0.0.1:6379>
127.0.0.1:6379> set name test
OK
127.0.0.1:6379> get name
"test"
127.0.0.1:6379> key *
(error) ERR unknown command `key`, with args beginning with: `*`,
127.0.0.1:6379> keys *
1) "name"
10、查看redis的进程是否开启!
[root@great-walk-2 ~]# ps -ef|grep redis
root 1047 1 0 11:50 ? 00:00:00 redis-server 127.0.0.1:6379
root 1052 956 0 11:51 pts/1 00:00:00 redis-cli -p 6379
root 1071 1055 0 11:51 pts/4 00:00:00 grep --color=auto redis
[root@great-walk-2 ~]#
11、如何关闭Redis服务呢? shutdown
127.0.0.1:6379> SHUTDOWN
not connected> EXISTS
Could not connect to Redis at 127.0.0.1:6379: Connection refused
not connected> exit
其中redis等工具下载链接5.0.7版本
链接:https://pan.baidu.com/s/19SVa6oT1BVtKJUwPYMRYpw
提取码:3rhd