RedisDesktopManager连接远程Linux系统的Redis服务

进入Redis安装目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
root@Ubuntu:/usr/local/software/redis-4.0.9# ll
total 316
drwxrwxr-x 6 root root 4096 Dec 4 15:47 ./
drwxr-xr-x 6 root root 4096 Dec 4 14:55 ../
-rw-rw-r-- 1 root root 157632 Mar 27 2018 00-RELEASENOTES
-rw-rw-r-- 1 root root 53 Mar 27 2018 BUGS
-rw-rw-r-- 1 root root 1815 Mar 27 2018 CONTRIBUTING
-rw-rw-r-- 1 root root 1487 Mar 27 2018 COPYING
drwxrwxr-x 6 root root 4096 Dec 4 11:49 deps/
-rw-rw-r-- 1 root root 376 Mar 27 2018 .gitignore
-rw-rw-r-- 1 root root 11 Mar 27 2018 INSTALL
-rw-rw-r-- 1 root root 151 Mar 27 2018 Makefile
-rw-rw-r-- 1 root root 4223 Mar 27 2018 MANIFESTO
-rw-rw-r-- 1 root root 20543 Mar 27 2018 README.md
-rw-rw-r-- 1 root root 58824 Dec 4 15:47 redis.conf (Redis配置文件)
-rwxrwxr-x 1 root root 271 Mar 27 2018 runtest*
-rwxrwxr-x 1 root root 280 Mar 27 2018 runtest-cluster*
-rwxrwxr-x 1 root root 281 Mar 27 2018 runtest-sentinel*
-rw-rw-r-- 1 root root 7606 Mar 27 2018 sentinel.conf
drwxrwxr-x 3 root root 4096 Dec 4 15:53 src/ (执行脚本)
drwxrwxr-x 10 root root 4096 Mar 27 2018 tests/
drwxrwxr-x 8 root root 4096 Mar 27 2018 utils/

进入src目录,执行脚本

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
root@Ubuntu:/usr/local/software/redis-4.0.9/src# ./redis-server
981:C 04 Dec 15:51:33.295 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
981:C 04 Dec 15:51:33.295 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=981, just started
981:C 04 Dec 15:51:33.295 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 4.0.9 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 981
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'

981:M 04 Dec 15:51:33.296 # Server initialized
981:M 04 Dec 15:51:33.296 * DB loaded from disk: 0.000 seconds
981:M 04 Dec 15:51:33.296 * Ready to accept connections

修改进程守护 daemonize yes

此时Redis服务已经可以成功启动了;但问题来了,界面一直停留在Redis服务窗口中,按Ctrl+C虽然可以屏蔽服务窗口,但同时也会结束Redis服务。

Redis服务默认是前台运行,需要修改为后台运行;返回上一层目录,修改redis.conf配置文件。找到daemonize(守护进程)配置,默认no

咱们修改了配置文件,但没告诉Redis读取最新的配置文件。启动服务的同时读取最新的配置文件

1
root@Ubuntu:/usr/local/software/redis-4.0.9/src# ./redis-server ../redis.conf

Redis默认只支持本地链接

编辑redis.conf配置文件

1
2
# bind 127.0.0.1
protected-mode no

修改完毕后保存,并且启动服务的同时读取最新的配置文件

输入进程命令查看

1
2
3
root@Ubuntu:/usr/local/software/redis-4.0.9/src# ps -ef | grep redis
root 1059 1 0 16:02 ? 00:00:00 ./redis-server *:6379
root 1065 1013 0 16:04 pts/1 00:00:00 grep --color=auto redis

编辑Linux关闭防火墙

关闭防火墙

1
sudo ufw disable

开启防火墙

1
sudo ufw enable

查看当前防火墙状态(inactive关闭状态 active开启状态)

1
sudo ufw status

添加安全组规则

根据自己购买的ECS平台添加安全组规则