VMware Workstation Pro虚拟机启动
Centos 7
MobaXterm连接虚拟机
输入个人密码
Redis启动
进入Redis文件目录
cd /usr/local/src/redis-6.2.6
Redis自启动
systemctl enable redis
systemctl start redis
查看Redis进程
ps -ef | grep redis
进入Redis操作
redis-cli -h 192.168.140.129 -p 6379 //虚拟机ip地址,通过ip addr查看 6379为redis端口号
AUTH 密码 //redis密码
关闭redis服务,修改配置文件(.conf文件)
在 /usr/local/src/redis-6.2.6目录下操作
关闭保护模式 把protected-mode yes 改成 protected-mode no
修改IP绑定,方便远程连接正常访问redis服务,这里是注释掉bind 127.0.0.1,并在下方写上bind 0.0.0.0
开启后台启动,daemonize yes
Another RedisDesktop Manager图形化界面
停止当前Redis服务并查看服务进程
systemctl stop redis
systemctl status redis
显示
● redis.service - redis-server
Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)
Active: inactive (dead) since 二 2024-09-24 14:36:08 CST; 6s ago
Process: 13829 ExecStart=/usr/local/bin/redis-server /usr/local/src/redis-6.2.6/redis.conf (code=
Main PID: 13830 (code=exited, status=0/SUCCESS)
9月 24 14:25:14 bogon systemd[1]: Starting redis-server...
9月 24 14:25:14 bogon systemd[1]: Started redis-server.
9月 24 14:36:08 bogon systemd[1]: Stopping redis-server...
9月 24 14:36:08 bogon systemd[1]: Stopped redis-server.
开放redis6379端口号,否则无法连接,图形化连接报错(Client On Error: Error: connect ETIMEDOUT 192.168.xxx.xxx:6379 Config right?)
将6379添加到防火墙,显示success
firewall-cmd --zone=public --add-port=6379/tcp --permanent
检查是否添加成功,显示no
firewall-cmd --query-port=6379/tcp
刷新防火墙,显示success
firewall-cmd --reload
检查是否添加成功,显示yes
firewall-cmd --query-port=6379/tcp
再次启动redis,并输入密码
redis-cli -h 192.168.140.129 -p 6379
AUTH 密码
图形化界面操作