Linux之redis 4.0.9的安装启动

------------------------------------------------------------------------------------------------------------------------
-----== redis 4.0.9安装    参考文档:https://blog.csdn.net/sawamuraeriri/article/details/80306181
1、安装依赖
    yum -y install gcc
    yum -y install gcc-c++
    yum -y install tcl

2、下载redis
    cd /fitness/software/
    mkdir redis-4.0.9
    cd redis-4.0.9
    wget wget http://download.redis.io/releases/redis-4.0.9.tar.gz

3、加压、安装
    tar -zxvf redis-4.0.9.tar.gz
    cd redis 4.0.9
    make

    结果,会出现如下:
    ...
    CC crc64.o
    CC bitops.o
    CC sentinel.o
    CC notify.o
    CC setproctitle.o
    CC blocked.o
    CC hyperloglog.o
    CC latency.o
    CC sparkline.o
    CC redis-check-rdb.o
    CC redis-check-aof.o
    CC geo.o
    CC lazyfree.o
    CC module.o
    CC evict.o
    CC expire.o
    CC geohash.o
    CC geohash_helper.o
    CC childinfo.o
    CC defrag.o
    CC siphash.o
    CC rax.o
    LINK redis-server
    INSTALL redis-sentinel
    CC redis-cli.o
    LINK redis-cli
    CC redis-benchmark.o
    LINK redis-benchmark
    INSTALL redis-check-rdb
    INSTALL redis-check-aof

    Hint: It's a good idea to run 'make test' ;)

    make[1]: Leaving directory `/fitness/software/redis-4.0.9/redis-4.0.9/src'

4、测试redis
    make test

    最后出现:
      29 seconds - unit/sort
      3 seconds - unit/slowlog
      29 seconds - unit/type/zset
      14 seconds - integration/aof
      2 seconds - unit/introspection
      4 seconds - unit/limits
      9 seconds - unit/introspection-2
      45 seconds - integration/replication-2
      9 seconds - unit/bitfield
      18 seconds - unit/bitops
      28 seconds - integration/psync2-reg
      25 seconds - unit/scripting
      6 seconds - unit/lazyfree
      35 seconds - integration/psync2
      8 seconds - unit/wait
      14 seconds - unit/memefficiency
      34 seconds - unit/maxmemory
      68 seconds - unit/type/list-2
      72 seconds - unit/dump
      87 seconds - integration/replication-4
      45 seconds - unit/hyperloglog
      98 seconds - integration/replication-3
      106 seconds - unit/aofrw
      61 seconds - unit/geo
      116 seconds - unit/type/list-3
      136 seconds - integration/replication
      125 seconds - integration/replication-psync
      116 seconds - unit/obuf-limits

    \o/ All tests passed without errors!

    Cleanup: may take some time... OK
    make[1]: Leaving directory `/fitness/software/redis-4.0.9/redis-4.0.9/src'

    表示测试通过!!!

5、安装redis到指定的目录
    make PREFIX=/fitness/serve/redis install

    结果:
    [root@iZ8vb2uz59jd5pisp87ljjZ redis-4.0.9]# make PREFIX=/fitness/serve/redis install
    cd src && make install
    make[1]: Entering directory `/fitness/software/redis-4.0.9/redis-4.0.9/src'

    Hint: It's a good idea to run 'make test' ;)

        INSTALL install
        INSTALL install
        INSTALL install
        INSTALL install
        INSTALL install
    make[1]: Leaving directory `/fitness/software/redis-4.0.9/redis-4.0.9/src'

    cd /fitness/serve/redis
    结果:
    [root@iZ8vb2uz59jd5pisp87ljjZ redis-4.0.9]# cd /fitness/serve/redis
    [root@iZ8vb2uz59jd5pisp87ljjZ redis]# ls
    bin

6、修改配置文件,并启动redis服务
    cd /fitness/software/
    cp redis.conf  /usr/local/etc/
    cd /usr/local/etc/
    vim redis.conf
    更改如下,136行:
     134 # By default Redis does not run as a daemon. Use 'yes' if you need it.
     135 # Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
     --》 daemonize yes

7、运行redis
    /fitness/serve/redis/bin/redis-server  /usr/local/etc/redis.conf
    结果:
    [root@iZ8vb2uz59jd5pisp87ljjZ bin]# /fitness/serve/redis/bin/redis-server  /usr/local/etc/redis.conf
    4633:C 01 Jul 21:09:43.730 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    4633:C 01 Jul 21:09:43.730 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=4633, just started
    4633:C 01 Jul 21:09:43.730 # Configuration loaded

    查看是否运行
    [root@iZ8vb2uz59jd5pisp87ljjZ bin]# ps aux | grep redis-server
    root      4634  0.0  0.0 145312  7520 ?        Ssl  21:09   0:00 /fitness/serve/redis/bin/redis-server 127.0.0.1:6379
    root      4904  0.0  0.0 112708   984 pts/0    S+   21:15   0:00 grep --color=auto redis-server

    /fitness/serve/redis/bin/redis-cli  /usr/local/etc/redis.conf


8、配置启动redis

    如果启动不了,可参照如下进行配置
    mkdir /usr/redis
    cp redis-server  /usr/redis
    cp redis-benchmark /usr/redis
    cp redis-cli  /usr/redis
    cp ../etc/redis.conf  /usr/redis

    建立软连接
    ln -s /fitness/serve/redis/bin/redis-server /usr/bin/redis-server
    ln -s /fitness/serve/redis/bin/redis-cli /usr/bin/redis-cli
    重新启动
    redis-server /fitness/serve/redis/etc/redis.conf

    [root@iZ8vb2uz59jd5pisp87ljjZ bin]# redis-server /fitness/serve/redis/etc/redis.conf
    6367:C 05 Jul 00:01:48.237 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
    6367:C 05 Jul 00:01:48.237 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=6367, just started
    6367:C 05 Jul 00:01:48.237 # Configuration loaded

    查看
    ps aux | grep redis-server
    [root@iZ8vb2uz59jd5pisp87ljjZ bin]# ps aux | grep redis-server
    root      6208  0.0  0.0 145312  7576 ?        Ssl  Jul04   0:00 ./redis-server *:6379
    root      6405  0.0  0.0 112708   980 pts/0    S+   00:02   0:00 grep --color=auto redis-server

------------------------------------------------------------------------------------------------------------------------
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值