Linux环境:Centos 6.8 
Redis服务端版本:3.2.6 
Redis客户端下载链接:https://redisdesktop.com/download

省略Linux系统安装Redis教程,网上安装教程很多;建议用tar.gz包安装 
Redis官网tar.gz下载地址:wget http://download.redis.io/releases/redis-3.2.6.tar.gz

安装时可能遇到的问题

问题1:make[3]: gcc: Command not found 
解决:Centos系统执行yum install gcc;Ubuntu系统执行apt-get install gcc


问题2:zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory 
zmalloc.h:55:2: error: #error “Newer version of jemalloc required” 
make[1]: * [adlist.o] Error 1 
解决:输入make MALLOC=libc,然后重新编译

安装完之后,进入Redis安装目录

[root@Karle redis-3.2.6]# ll
总用量 208
-rw-rw-r--. 1 root root 80406 12月 6 2016 00-RELEASENOTES
drwxr-xr-x. 2 root root 4096 1月 4 2017 bin
-rw-rw-r--. 1 root root 53 12月 6 2016 BUGS
-rw-rw-r--. 1 root root 1805 12月 6 2016 CONTRIBUTING
-rw-rw-r--. 1 root root 1487 12月 6 2016 COPYING
drwxrwxr-x. 7 root root 4096 1月 4 2017 deps
drwxr-xr-x. 2 root root 4096 1月 4 2017 etc
-rw-rw-r--. 1 root root 11 12月 6 2016 INSTALL
-rw-rw-r--. 1 root root 151 12月 6 2016 Makefile
-rw-rw-r--. 1 root root 4223 12月 6 2016 MANIFESTO
-rw-rw-r--. 1 root root 6834 12月 6 2016 README.md
-rw-rw-r--. 1 root root 46696 9月 10 10:06 redis.conf (Redis配置文件)
-rwxrwxr-x. 1 root root 271 12月 6 2016 runtest
-rwxrwxr-x. 1 root root 280 12月 6 2016 runtest-cluster
-rwxrwxr-x. 1 root root 281 12月 6 2016 runtest-sentinel
-rw-rw-r--. 1 root root 7606 12月 6 2016 sentinel.conf
drwxrwxr-x. 2 root root 4096 9月 10 10:08 src (执行脚本)
drwxrwxr-x. 10 root root 4096 12月 6 2016 tests
drwxrwxr-x. 7 root root 4096 12月 6 2016 utils

进入src目录,执行脚本

[root@Karle src]# ./redis-server

[root@Karle src]# ./redis-server
2745:C 10 Sep 10:16:13.130 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
2745:M 10 Sep 10:16:13.131 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-`` `. `_. ''-._ Redis 3.2.6 (00000000/0) 64 bit
.-`` .-```. ```\/ _.,_ ''-._
( ' , .-` | `, ) Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'| Port: 6379
| `-._ `._ / _.-' | PID: 2745
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-' 2745:M 10 Sep 10:16:13.145 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
2745:M 10 Sep 10:16:13.145 # Server started, Redis version 3.2.6
2745:M 10 Sep 10:16:13.147 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
2745:M 10 Sep 10:16:13.147 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
2745:M 10 Sep 10:16:13.147 * DB loaded from disk: 0.000 seconds
2745:M 10 Sep 10:16:13.147 * The server is now ready to accept connections on port 6379

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

2745:M 10 Sep 10:23:04.765 # User requested shutdown… 
2745:M 10 Sep 10:23:04.765 * Saving the final RDB snapshot before exiting. 
2745:M 10 Sep 10:23:04.767 * DB saved on disk 
2745:M 10 Sep 10:23:04.767 # Redis is now ready to exit, bye bye…

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

daemonize yes

此时满脸自信地回到src目录执行

[root@Karle src]# ./redis-server

擦,还是前台运行;咋回事?什么毛病?这是咱们修改了配置文件,但没告诉Redis读取最新的配置文件。

启动服务的同时读取最新的配置文件(必须)

[root@Karle src]# ./redis-server ../redis.conf

下载RedisDesktopManager客户端,输入服务器IP地址,端口(缺省值:6379);点击Test Connection按钮测试连接,噢,My God,连接失败!

什么问题呢?原因是Redis默认只支持本地链接,输入进程命令查看得知(127.0.0.1:6379)

[root@Karle src]# ps -ef | grep redis 
root 5239 1 0 10:37 ? 00:00:00 ./redis-server 127.0.0.1:6379 
root 5244 2321 0 10:37 pts/0 00:00:00 grep redis

问题解决:编辑redis.conf配置文件;注释掉61行本地链接限制以及80行配置修改为no

61 # bind 127.0.0.1 
80 protected-mode no

读取最新配置文件并重启,查看Redis进程情况!我再擦,什么鬼,都开放IP链接权限了,怎么还是127.0.0.1:6379!!

[root@Karle src]# ./redis-server ../redis.conf 
[root@Karle src]# ps -ef | grep redis 
root 5352 1 0 10:59 ? 00:00:00 ./redis-server 127.0.0.1:6379 
root 5367 2321 0 11:00 pts/0 00:00:00 grep redis

问题解决:先杀掉Redis进程,src目录下依次执行

[root@Karle src]# redis-cli shutdown 
[root@Karle src]# ./redis-server ../redis.conf

再查看进程情况:

[root@Karle src]# ps -ef | grep redis 
root 5391 1 0 11:05 ? 00:00:00 ./redis-server *:6379 
root 5395 2321 0 11:05 pts/0 00:00:00 grep redis

哇塞,*.6379,这意味着已经成功开放IP访问权限了。万事俱备,只欠点击RedisDesktopManager客户端测试链接按钮了。好,走起。 
当你信心满满的时候,现实总泼你一盆冷水来清醒!链接失败,链接失败,我都不好意思截图上传了!!这又是闹哪样啊?还让我活不???

左思右想,突然,我想到一个词——防火墙

[root@Karle src]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3306
8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:15672
9 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

编辑Linux防火墙 
[root@Karle src]# vi /etc/sysconfig/iptables 
加入防火墙规则:-A INPUT -m state –state NEW -m tcp -p tcp –dport 6379 -j ACCEPT

[root@cthon src]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:8080
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:80
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3306
8 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:15672
9 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:6379
10 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited

重启Linux防火墙 
[root@Karle src]# service iptables restart

点击Test Connection按钮测试连接,连接成功,大功告成

补充:在ubuntu等版本的linux系统下,不妨将redis.cconf文件中 的bind改为0.0.0.0

Redis 客户端安装与远程连接图解的更多相关文章

  1. linux安装mysql全纪录[包括yum和rpm安装,编码,远程连接以及大小写问题]

    linux安装mysql全纪录[包括yum和rpm安装,编码,远程连接以及大小写问题] 一.查看mysql是否已经安装 使用“whereis mysql”命令来查看mysql安装路径: [root@h ...

  2. 3 Oracle 32位客户端安装及arcgis连接

    关于Oracle服务器端安装及配置的过程详见第2篇文章,链接如下:http://www.cnblogs.com/gistrd/p/8494292.html,本篇介绍客户端安装配置及连接arcgis过程 ...

  3. centos7最小安装后——网络配置、常见命令安装,远程连接、yum源安装软件包

    安装环境 #软件:vmware 14 #centos版本:CentOS-7-x86_64-DVD-1810 下载地址: #网络配置:NAT模式 配置 网络配置 #动态获取ip: centos7最小安装 ...

  4. redis安装以及远程连接

    第一步下载: Window 下安装 下载地址:https://github.com/MSOpenTech/redis/releases. 第二步: 运行安装 记录安装路径 C:\Program Fil ...

  5. centos7远程服务器中redis的安装与java连接

    1.下载安装redis 在远程服务器中你想下载的位置执行以下命令来下载redis文件到服务器中 $ wget http://download.redis.io/releases/redis-4.0.9 ...

  6. 基于Git项目管理客户端SourceTree的免注册安装及远程连接方法

    作为程序员,不可避免的要在github上查询代码,而在企业项目中,为了使得项目好管理需要使用项目管理客户端,所以接下来详细讲解一下基于git的sourceTree在windows系统下的安装及与Git ...

  7. Oracle客户端的安装与远程连接配置

    在继续Oracle客户端的安装之前,需要分析一下Oracle客户端与数据库服务器之间的连接机制. 一.Oracle客户端与服务器端的通讯机制 1.Oracle Net协议 如下图所示,Oracle通过 ...

  8. MySql数据库安装&修改密码&开启远程连接图解

    相关工具下载地址: mysql5.6 链接:http://pan.baidu.com/s/1o8ybn4I密码:aim1 SQLyog-12.0.8 链接:http://pan.baidu.com/s ...

  9. Redis02 Redis客户端之Java、连接远程Redis服务器失败

    1 查看支持Java的redis客户端 本博文采用 Jedis 作为redis客户端,采用 commons-pool2 作为连接redis服务器的连接池 2 下载相关依赖与实战 2.1 到 Repos ...

随机推荐

  1. JQuery利用选择器定位动态id?

    假如我们需要去定位一个动态生成的div,我们需要为它指定一个动态的id 例如: 前台使用EL进行迭代LIST生成div,为其添加动态的id,生成之后变成下面样式 <div id="tz ...

  2. hadoop 相关工具访问端口(转)

    原文:http://www.tuicool.com/articles/BB3eArJ hadoop系统部署时用到不少端口.有的是Web UI所使用的,有的是内部通信所使用的,有的是监控所使用的.实际系 ...

  3. 【C语言】一句printf代码——{ a[0] ? 0[a] }

    这是前段时间做的http://fun.coolshell.cn/中的一道题,很有意思,涉及的其实是C的基础,不过当时第一次看见这行代码确实把我弄懵了: printf(&unix["\ ...

  4. python scrapy爬虫框架

    http://scrapy-chs.readthedocs.io/zh_CN/0.24/intro/tutorial.html scrapy 提取html的标签内容 from scrapy.selec ...

  5. Android-Android Studio 3.0找不到Android Device Monitor

    原文:https://blog.csdn.net/yuanxiang01/article/details/80494842?utm_source=copy   为什么Android Studio 3. ...

  6. nstall-Package : 无法找到程序包“MySql.Data.Entity.EF6”

    在vs2013中用MySQL+EF6时,会遇到版本的问题,解决方法一般如下: 1 Install-Package EntityFramework -Version 6.0.0然后Enter2 Inst ...

  7. 【BZOJ3630】[JLOI2014]镜面通道 几何+最小割

    [BZOJ3630][JLOI2014]镜面通道 Description 在一个二维平面上,有一个镜面通道,由镜面AC,BD组成,AC,BD长度相等,且都平行于x轴,B位于(0,0).通道中有n个外表 ...

  8. 九度OJ 1033:继续xxx定律 (基础题)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:4987 解决:1201 题目描述:     当n为3时,我们在验证xxx定律的过程中会得到一个序列,3,5,8,4,2,1,将3称为关键数, ...

  9. python数据分析之Pandas:汇总和计算描述统计

    pandas对象拥有一组常用的数学和统计方法,大部分都属于约简和汇总统计,用于从Series中提取单个的值,或者从DataFrame中的行或列中提取一个Series.相比Numpy而言,Numpy都是 ...

  10. matlab使用usb和gige 网口相机

    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 辛苦原创所得,转载请注明出处 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% ...