1, the step of mounting redis
1, the recommended route into linux / usr / local / the src
2, $ . 3, the xzf $ Redis the tar-4.0.10.tar.gzwget http://download.redis.io/releases/redis-4.0.10.tar.gz
4、$ cd redis-4.0.10/
5、$ make
At this point, redis installed, we can use the following two commands test
Compiled binary file is completed in the src directory, start the Redis service through the following command $ src / redis- Server $ src / redis- cli Redis> the SET foo bar the OK Redis> GET foo "bar"
2, modify the configuration file redis.conf
(1), # bind 127.0.0.1 here in front of the remote can not connect with the # redis or otherwise can only be connected to the local loopback ip address 127.0.0.1, unable to connect real ip.
(2), daemonize yes (speaking here of the original no change yes, the purpose is to set running in the background)
(3), protected-mode no (speaking here of the original yes to no, the purpose is to solve the cause of the error in Safe Mode)
3, the mobile redis profile
1, create a file inside the etc folder
mkdir / etc / redis
Note: Permissions issue 777
2, the move to the new configuration file folder
cp redis.conf / etc / redis /
4, killing redis redis and re-open the background
pkill -9 redis-server src/redis-server /etc/redis/redis.conf
5, detection is turned redis
ps AXU | grep redis-server
If time is the latest open redis, the show opened, it can connect remotely.
6, add a password and log on with a password
Need permanent configuration password, then go redis.conf profile found requirepass this parameter.
Redis.conf modify configuration files
Requirepass foobared #
requirepass specify a password 123 123
After saving reboot redis
7, the remote client is connected via ip redis
src/redis-cli -h 192.168.20.2 -p 6379
8, set the boot from the start
cd to the source directory redis
1. Copyredis.conf
cp redis.conf /etc/redis/redis.conf
2.拷贝redis_init_script
cp utils/redis_init_script /etc/init.d/redis
3.修改redis.conf
daemonize
为yes
表示以后台程序方式运行
vi /etc/redis/redis.conf
4. Switch to /etc/init.d
execute a command from the start
chkconfig redis on
重启redis或者kill -9 redis
重新启动。
src/redis-server /etc/redis/redis.conf
自启动添加成功。