Redis (1) CentOS builds Redis 2.8.9 in ten minutes
Redis introduction is no longer cumbersome. 1. Install gcc, because Redis is written in C language. So you need gcc to compile yum install gcc-Y2, download redis-2.8.9.tar.gz http://download.redis.io/releases/redis-2.8.9.tar.gz3, install Redis tar xf redis-2.8.9.tar.gz cd redis-2.8.9 make MALLOC=libc make PREFIX=/usr/local/redis install4, Check the directory and file [root@salt-server bin] # pwd / usr/local/redis/bin [root@salt-server bin] # ls redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server5 after the installation is complete. Command interpretation redis-server:redis server daemon launcher redis-cli:redis command line operation tool redis-benchmark:redis performance test tool redis-check-aof: update log appendonly.aof check redis-check-dump: check for local database rdb files 6. Configure startup service settings environment variables: vim / etc/profile PATH=$PATH:/usr/local/redis/bin source / etc/profile copy configuration file: mkdir / usr/local/redis/conf cp redis-2.8.9/redis.conf / usr/local/redis/conf Echo "vm.overcommit_memory = 1" > > / etc/sysctl.conf & & sysctl-p launch service: redis-server / usr/local/redis/conf/redis.conf & 7, The normal feedback for successful startup is as follows: [root@salt-server ~] # redis-server / usr/local/redis/conf/redis.conf & [1] 11736 [root@salt-server ~] # [11736] 27 Jan 09VOV 16V 07.772 * Increased maximum number of open files to 10032 (it was originally set to 1024). _. _.-`. `_. '' -. _ Redis 2.8.9 (000000Universe 0) 64 bit.-``.- ```. ```\ / _., _'-. _ (.-`|` ) Running in stand alone mode | `-. _` -.-`_ _...-.`` -. _ |'` _. -'| Port: 6379 | `-. _`. _ / _.-'PID: 11736 `-. _` -. _ `. | | `-. _. -'| |` -. _ `-. _. -'_. -'| http://redis.io` -. _ `-. _`- . _. -'| `-. _. -'_. -'| |` -. _ `. -'_. -'_. -'| `-. _` -. _. -'_.-`-. _`. -'.-`. -` -. _.-``-. _ _. -'[11736] 27 Jan 09 16V 07.773 # Server started Redis version 2.8.9 [11736] 27 Jan 09 The server is now ready to accept connections on port 07.773 * The server is now ready to accept connections on port 6379 8 If the basic operation is turned off, you can enter redis-cli directly into [root@salt-client1] # redis-cli 127.0.0.1 redis-cli 6379 > input values and test [root@salt-client1] # redis-cli 127.0.0.1 root@salt-client1 6379 > set Test 001 / / setting. Set a Test value of 001 OK 127.0.0.1 Test 6379 > get Test / / to get the value of 001 127.0.1 Test 6379 > del Test / / Delete a value (integer) 1 127.0.0.1 6379 > keys * / / take all values 9, The client connection uses [root@salt-client1 ~] # redis-cli-h 172.16.10.133-p 6379 172.16.10.133 root@salt-client1 > or direct assignment [root@salt-client1 ~] # redis-cli-h 172.16.10.133-p 6379 set Test 789 OK [root@salt-client1 ~] # redis-cli-h 172.16.10.133 -p 6379 get Test 789 10, Redis Security sets the external connection password vim / usr/local/redis/conf/redis.conf for the redis client to modify the requirepass as follows: requirepass a) s$M7F57TN58 $8 restart redis redis-cli shutdown redis-server / usr/local/redis/conf/redis.conf & the direct login test will prompt the authentication failure to specify the password [ Root@salt-server ~] # redis-cli 127.0.0.1 set d 1 (error) NOAUTH Authentication required. 127.0.0.1auth 6379 > login with specified password [root@salt-server ~] # redis-cli 127.0.0.1 auth a) s$M7F57TN58 $8 OK Over