Centos-6.8 x64安装redis-3.2.8

Redis源码安装 安装环境Centos-6.8 x64 redis-3.2.8.tar.gz(放置在download下)
1.解压文件
[root@LS-Min download]# tar -zxvf redis-3.2.8.tar.gz
...
[root@LS-Min download]# cd redis-3.2.8
2.编译文件
[root@LS-Min redis-3.2.8]# make
...
[root@LS-Min redis-3.2.8]# cd src
3.测试是否编译成功
[root@LS-Min src]# ./redis-server
4590:C 03 Mar 14:07:31.106 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
4590:M 03 Mar 14:07:31.106 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._
           _.-``__ ‘‘-._
      _.-``    `.  `_.  ‘‘-._           Redis 3.2.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ‘‘-._
 (    ‘      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|‘` _.-‘|     Port: 6379
 |    `-._   `._    /     _.-‘    |     PID: 4590
  `-._    `-._  `-./  _.-‘    _.-‘
 |`-._`-._    `-.__.-‘    _.-‘_.-‘|
 |    `-._`-._        _.-‘_.-‘    |           http://redis.io
  `-._    `-._`-.__.-‘_.-‘    _.-‘
 |`-._`-._    `-.__.-‘    _.-‘_.-‘|
 |    `-._`-._        _.-‘_.-‘    |
  `-._    `-._`-.__.-‘_.-‘    _.-‘
      `-._    `-.__.-‘    _.-‘
          `-._        _.-‘
              `-.__.-‘                                               

4./usr/local下建立redis文件夹
[root@LS-Min src]# mkdir -p /usr/local/redis-3.2.8/conf
[[email protected] src]# mkdir -p /usr/local/redis-3.2.8/bin
5.将redis-3.2.8/src目录下可执行文件复制
[root@LS-Min src]# cp redis-server redis-cli redis-benchmark redis-check-aof redis-check-rdb redis-sentinel /usr/local/redis-3.2.8/bin
[[email protected]-Min src]# cd ../
[[email protected] redis-3.2.8]# cp redis.conf /usr/local/redis-3.2.8/conf
6.作为系统服务
[root@LS-Min redis-3.2.8]# cp utils/redis_init_script /etc/init.d/redis

7.编辑redis.conf
[root@LS-Min redis-3.2.8]# vim /usr/local/redis-3.2.8/conf/redis.conf
 (1)bind 127.0.0.1 后追加 本机ip
    bind 127.0.0.1 10.21.36.120
 (2)daemonize no --> daemonize yes 守护进程运行
 (3)pidfile /var/run/redis_6379.pid -->pidfile /var/run/redis.pid
 (4)logfile "" --> logfile "/usr/local/redis-3.2.8/logs/redis.log"
 (5)#requirepass foobared --> requirepass abcd1234 启用密码
[[email protected] redis-3.2.8]#wq
8.编辑init.d/redis
[root@LS-Min redis-3.2.8]# vim /etc/init.d/redis
 (1)增加
  # chkconfig: 2345 90 10
  # description: Redis is a persistent key-value database
 (2)EXEC=/usr/local/redis-3.2.8/bin/redis-server
 (3)CLIEXEC=/usr/local/redis-3.2.8/bin/redis-cli
 (4)PIDFILE=/var/run/redis.pid
 (5)CONF="/usr/local/redis-3.2.8/conf/redis.conf"
 (6)$CLIEXEC -p $REDISPORT shutdown -->$CLIEXEC -a "abcd1234" -p $REDISPORT shutdown  #-a 指定密码
[[email protected] redis-3.2.8]#wq
9.开机自启动
 [root@LS-Min redis-3.2.8]# chkconfig redis on

10. 开放防火墙6379端口
[root@LS-Min ~]# vim /etc/sysconfig/iptables
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT 下增加
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 6379  -j ACCEPT
[root@LS-Min ~]# service iptables restart
iptables: Setting chains to policy ACCEPT: filter          [  OK  ]
iptables: Flushing firewall rules:                         [  OK  ]
iptables: Unloading modules:                               [  OK  ]
iptables: Applying firewall rules:                         [  OK  ]

 常见问题:
(1)bind 127.0.0.1 10.21.36.120 绑定10.21.36.120后,让其他机器访问,不能去掉127.0.0.1否则本机服务stop会失败
 [root@LS-Min ~]# service redis stop
   Stopping ...
   Could not connect to Redis at 127.0.0.1:6379: Connection refused
   Waiting for Redis to shutdown ...
   Waiting for Redis to shutdown ...
(2)启用密码后,/etc/init.d/redis 要做修改$CLIEXEC -p $REDISPORT shutdown -->$CLIEXEC -a "abcd1234" -p $REDISPORT shutdown
   否则本机服务stop会失败
   [root@LS-Min ~]# service redis stop
   Stopping ...
   OK
   (error) NOAUTH Authentication required.
   Waiting for Redis to shutdown ...
   Waiting for Redis to shutdown ..

(3))service redis stop失败时 停止redis服务
   [root@LS-Min ~]# ps -ef|grep redis
   root      4518     1  0 13:47 ?        00:00:00 /usr/local/redis-3.2.8/bin/redis-server 127.0.0.1:6379
   [[email protected] ~]# kill -9 4518
   [[email protected] ~]# rm -rf /var/run/redis.pid
时间: 2024-08-04 02:03:08

Centos-6.8 x64安装redis-3.2.8的相关文章

CentOS 6.5 x64 安装Tomcat8 并配置两个Tomcat8

1.首先,安装tomcat的前提是已经配置好jdk环境变量,若没配好可以参考我的上一篇博文:CentOS 6.5 x64安装jdk8,当然也可以通过网络搜索安装步骤~~ 2.下载: 可以通过官网下载:http://tomcat.apache.org/download-80.cgi,我下载的是这个. 3.在xftp中,进入/usr/local目录,新建一个文件夹为tomcat8,进入后建立两个文件夹(因为我们要装两个tomcat),分别为tom8081(代表8081端口),tom8082(代表80

CentOS 6.5 x64 安装jdk8

1.去官网下载Linux版本的jdk8,我下载的是下面这个 2.下载xftp和xshell来操纵服务器,可以搜索一下下载安装即可,安装完成后,打开xshell,新建链接为你的云服务器的IP地址和密码,链接后,打开下面的选项 打开后进入/usr/local路径新建文件夹为java,进入后将下载好的jdk拖进来即可 3.在xshell里面输入如下命令: //进入java目录 cd /usr/local/java //解压缩jdk tar -zxv -f jdk-8u111-linux-x64.tar

Centos 7.3 x64安装nginx 与反向代理的应用

Centos 7.3 x64安装nginx-1.13.1 nginx-1.13.1 发布日期2017-05-30 测试完成日期:2017.6.22 by evan.li 一.安装必要所需环境: # yum install autoconf automake gcc gcc-c++ libtool make pkgconfig zlib-devel  # yum install pcre pcre-devel php-devel httpd-devel # yum install zlib zli

4# CentOS 6.7 x64 安装Subversion1.9.3(svn,http)

系统安装按照1# CentOS 6.7 x64 最小化安装 Apache/PHP/MariaDB环境按照2# CentOS 6.7 x64 Apache/PHP/Mariadb环境搭建 更新Python # CentOS 6.7 x64 默认使用Python2.6, 我把它更新成了2.7 [[email protected] src]# wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 [[email protected] 

centos下php环境安装redis

一.安装redis(仅可在服务器使用,尚不能通过浏览器访问) (1)首先下载redis:wget http://download.redis.io/releases/redis-4.0.9.tar.gz (2)解压redis:tar -zxvf redis-4.0.9.tar.gz (3)进入redis目录:cd redis-4.0.9 (4)make编译:make (5)进入redis的src目录执行:cd src (6)执行开启redis:./redis-server 如果看到redis独特

CentOS 7.3下安装Redis

1.  安装编译器GCC 安装前可以使用yum list installed | grep ‘gcc’来检查一下系统里面是否已经安装了gcc编译软件. 安装编译器的命令为:yum –y  install  gcc  gcc-c++ 2.  下载redis wget http://download.redis.io/releases/redis-5.0.4.tar.gz 3.  安装redis 1)  解压压缩包(将压缩包解压到/usr/apps/下) tar –zxvf redis-5.0.4.

CentOS 6.5 下安装 Redis 2.8.7

wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make 前面3步应该没有问题,主要的问题是执行make的时候,出现了异常. 异常一: make[2]: cc: Command not found 异常原因:没有安装gcc 解决方案:yum install gcc-c++ 异常二: zmalloc.h:51:31: error: jemalloc/jema

CentOS 6.5 下安装 Redis

wget http://download.redis.io/redis-stable.tar.gz tar xvzf redis-stable.tar.gz cd redis-stable make 前面3步应该没有问题,主要的问题是执行make的时候,出现了异常. 异常一: make[2]: cc: Command not found 异常原因:没有安装gcc 解决方案:yum install gcc-c++ 异常二: zmalloc.h:51:31: error: jemalloc/jema

CentOS 6.5 x64安装svn

#svn安装 yum install -y subversion 卸载svn旧版本 yum remove -y subversion wget http://pkgs.repoforge.org/subversion/subversion-1.7.4-0.1.el6.rfx.x86_64.rpm 安装新版本 rpm -ivh subversion-1.7.4-0.1.el6.rfx.x86_64.rpm 创建svn根目录 mkdir /svndata 创建svn公共配置目录 mkdir -p /

Centos 6.5 x64 安装tinyproxy http代理

TinyProxy是个非常便利,及容易架设的HTTP代理,和squid相比,tinyproxy更小,更好使用. 线上的一台Google代理服务器用的是meow,也是一款http代理软件.但是有一个缺点,需要后台启动,而且,运行一段时间,进程就会挂掉.所以不得不写个脚本,来监控进程,防止挂掉. 准备搭建一个爬虫服务器,买了一个VPN,可以随时切换IP的.后端PHP程序只需要调用这台的http代理就可以了. http代理不能断,所以选择了tinyproxy. 安装方法,有2中. yum instal