文章目录
1、查看redis安装的目录
bash
[root@localhost ~]# cd /usr/local/redis/
[root@localhost redis]# ll
总用量 112
drwxr-xr-x. 2 root root 150 12月 6 2023 bin
-rw-r--r--. 1 root root 89 12月 20 2023 dump.rdb
-rw-r--r--. 1 root root 106546 12月 6 2023 redis.conf
[root@localhost redis]#
2、Redis以后台的方式启动
bash
[root@localhost ~]# /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf
[root@localhost ~]# ps -ef | grep redis
root 4270 1 0 16:19 ? 00:00:00 /usr/local/redis/bin/redis-server *:6379
root 4290 3385 0 16:20 pts/0 00:00:00 grep --color=auto redis
[root@localhost ~]# ps -ef | grep redis | grep -v grep
root 4270 1 0 16:19 ? 00:00:00 /usr/local/redis/bin/redis-server *:6379
[root@localhost ~]#
3、通过客户端连接redis
bash
[root@localhost ~]# /usr/local/redis/bin/redis-cli -p 6379
127.0.0.1:6379>
4、连接后,测试与redis的连通性
bash
[root@localhost ~]# /usr/local/redis/bin/redis-cli -p 6379
127.0.0.1:6379> ping
PONG
127.0.0.1:6379>