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. Volley框架载入网络图片

    Android开发中,载入网络server的图片是非经常常使用的.当然我们能够自己写server接口去实现,只是要做到server性能 优越的话,开发起来比較麻烦点.所以本博客要介绍Volley框架进 ...

  2. Android应用开发:网络工具——Volley(二)

    引言 在Android应用开发:网络工具--Volley(一)中结合Cloudant服务介绍了Volley的一般使用方法.当中包括了两种请求类型StringRequest和JsonObjectRequ ...

  3. iPhone与iPad开发实战读书笔记

    iPhone开发一些读书笔记 手机应用分类1.教育工具2.生活工具3.社交应用4.定位工具5.游戏6.报纸和杂志的阅读器7.移动办公应用8.财经工具9.手机购物应用10.风景区相关应用11.旅游相关的 ...

  4. java的Access restriction错误

    问 :import sun.management.ManagementFactory,我在rt包下已经找到sun.management.ManagementFactory,但就是有错,请问怎么回事. ...

  5. 九度OJ 1175:打牌 (模式匹配)

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:8156 解决:1560 题目描述: 牌只有1到9,手里拿着已经排好序的牌a,对方出牌b,用程序判断手中牌是否能够压过对方出牌.  规则:出牌 ...

  6. iOS10.3 UILable中划线失效问题

    iOS10.3系统的一个Bug,在UILable中含有中文时,中划线会失效 NSString *priceStr = [NSString stringWithFormat:@"%.2f元&q ...

  7. Regularization: how complicated the model is? Regularization, measures complexity of model 使预测准确、平稳 predictive stable

    http://www.kdd.org/kdd2016/papers/files/rfp0697-chenAemb.pdf https://homes.cs.washington.edu/~tqchen ...

  8. 基于Flume的美团日志收集系统 架构和设计 改进和优化

    3种解决办法 https://tech.meituan.com/mt-log-system-arch.html 基于Flume的美团日志收集系统(一)架构和设计 - https://tech.meit ...

  9. 在非OnPaint里应该使用ClientDC来画图

    import wx class Example(wx.Frame): def __init__(self, parent, title): super(Example, self).__init__( ...

  10. 认识影片版本(CAM、TS、TC、DVD、HD、BD、TVRIP等)

    许多朋友在下载电影的时候, 往往会被各种各样的版本标识弄糊涂,今天把各种版本的缩写收集在一起,希望对大家有所帮助 . 引用: 1.CAM(枪版)    CAM 通常是用数码摄像机从电影院盗录.有时会使 ...