Ubuntu14.04 set up Redis environment

Ubuntu14.04 set up Redis environment

download

  • step1: Download

    wget http://download.redis.io/releases/redis-3.2.8.tar.gz

  • step2: unzip

    takes -zxvf Redis-3.2.8.tar.gz

  • step3: copy, put usr / local destination time record

    sudo mv ./redis-3.2.8 /usr/local/redis/

  • step4: gets into redis of Contents

    cd /usr/local/redis/

  • step5: generation

    sudo make

  • step6: test, this time will be when running a relatively ⻓

    sudo make test

  • step7: installation, the installation redis command to / usr / local / bin / of Contents

    sudo make install

  • step8: After installation is complete, we enter the directory / usr / local / bin View

    cd /usr/local/bin
    ls -all

    • redis-server redis server
    • redis-cli redis command line client
    • redis-benchmark redis performance testing tools
    • redis-check-aof AOF file repair tool
    • redis-check-rdb RDB file retrieval tool
  • step9: configuration files, move to / etc / under of Contents

  • Configuration files of Contents for the/usr/local/redis/redis.conf

    sudo cp /usr/local/redis/redis.conf /etc/redis/

Configuration

  • Redis configuration information in the /etc/redis/redis.confcase.

  • View

    south you /etc/redis/redis.conf

Core Configuration Options

  • Binding ip: If you require remote access, you can comment this ⾏, or bind ⼀ a real ip

    bind 127.0.0.1

    Note: linux terminal operations, notes or modify it to 127.0.0.1, or else not to log on locally.

    Remote Access: For example, here is my configuration:bind 192.168.214.128

  • End-connector, the default is 6379

    port 6379

  • Whether when running a daemon

    daemonize yes

    • If when running a daemon, it will not ⾏ blocked in command, similar to the service
    • If the order comes in handy when running a daemon, the current terminal is blocked
    • Setting indicates daemon to yes, to no representation comes in handy daemon
    • The recommended setting is yes
  • Data files

    dbfilename dump.rdb

  • File data storage path

    dir / var / lib / redis

  • Zhi-date files

    logfile /var/log/redis/redis-server.log

  • Database, default 16

    database 16

  • From the master copy, similar to the two backup.

    slaveof

Reference material

redis configuration information http://blog.csdn.net/ljphilp/article/details/52934933

Operating redis

EDITORIAL

I'm usually so dry: I put the configuration file of bind 192.168.214.128the Notes

  1. First check whether redis start: ps aux|grep redis;
  2. Specify the load profile way to start the Redis: sudo redis-server /etc/redis/redis.conf;
  3. Kill redis server: sudo kill -9 pid;
  4. Start the client:redis-cli -h 要访问的ip -p 端口(6379)
  5. Here you can have fun playing the

Service-Terminal

  • Server commandredis-server

  • You can use the help to see the documentation that help

    redis-server --help

  • Recommended Use Service shutter mode management services redis

  • start up

    sudo service redis start

  • Stop

    sudo service redis stop

  • Restart sudo service redis restart

Client

  • Client command redis-cli

  • You can use the help to see the documentation that help

    redis-cli --help

  • Connection redis

    redis-cli

  • When running a test command

    ping

  • Switching Database

  • No database name, the default 16, identified by 0-15, connecting the first database selected by default redis

    select n

Guess you like

Origin www.cnblogs.com/benjieqiang/p/11390107.html