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. 开源项目WebImageView载入图片

    项目地址:https://github.com/ZaBlanc/WebImageView 作者对载入图片,以及图片的内存缓存和磁盘缓存做了封装. 代码量不多.可是可以满足一般的载入图片. 先看下项目结 ...

  2. redis问题接囧办法及经验

    转自:https://my.oschina.net/freegeek/blog/324410 1.redis持久化,来自官方说明 如何选择使用哪种持久化方式? 一般来说, 如果想达到足以媲美 Post ...

  3. Codeforces Round #316 (Div. 2) (ABC题)

    A - Elections 题意: 每一场城市选举的结果,第一关键字是票数(降序),第二关键字是序号(升序),第一位获得胜利. 最后的选举结果,第一关键字是获胜城市数(降序),第二关键字是序号(升序) ...

  4. 配置springMVC时出现的问题

    配置springMVC时出现的问题 项目结构如图:

  5. 单例模式(Mongo对象的创建)

    单例模式: 饿汉式单例 //饿汉式单例类.在类初始化时,已经自行实例化 public class Singleton1 { //私有的默认构造子 private Singleton1() {} //已 ...

  6. CrystalReport runtime的下载地址

    SAP网站的东西实在太多了,找个CrytalReport都费劲.13.*版的可以通过下面的地址下载: SAP Crystal Reports, developer version for Micros ...

  7. EF学习和使用(三)Code First

    Code First模式我们称之为"代码优先"模式.从某种角度来看.其实"Code First"和"Model First"区别并非太明显. ...

  8. iOS Dev (53) 修复UIImagePickerController偷换StatusBar颜色的问题

    版权声明:本文为 CSDN 博主 大锐哥(ID 为 prevention)原创文章,未经博主同意不得转载. https://blog.csdn.net/prevention/article/detai ...

  9. Java for LeetCode 135 Candy

    There are N children standing in a line. Each child is assigned a rating value. You are giving candi ...

  10. Java for LeetCode 088 Merge Sorted Array

    Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. 解题思路一: ...