Redis (1): installation, configuration

Redis installation, configuration

1. Download redis

[root@VM_0_17_centos redis]#  wget http://download.redis.io/releases/redis-4.0.6.tar.gz

2. Unzip

[root@VM_0_17_centos redis]# tar -zxvf redis-4.0.6.tar.gz 

3. Compile

[root@VM_0_17_centos redis-4.0.6]# make MAlLOC=libc

4. Start

[root@VM_0_17_centos redis-4.0.6]# ./src/redis-server

5. Register as a service

Copy the configuration file to /etc/redis

[root@VM_0_17_centos redis-4.0.6]# mkdir /etc/redis
[root@VM_0_17_centos redis-4.0.6]# cp redis.conf /etc/redis/6379.conf

Copy redis_init_script under util to /etc/init.d

[root@VM_0_17_centos utils]# cp redis_init_script /etc/init.d/redis

Start the test

[root@VM_0_17_centos ~]# service redis start

6. Modify the configuration file

[root@VM_0_17_centos ~]# vim /etc/redis/6379.conf
# 守护启动
daemonize yes 
# 修改bind  bind 允许客户端IP的链接 
# 注释掉bind 127.0.0.1 不设置bind 则为不限制
# 密码 requirepass 
# 解除 requirepass foobared 设置成自己密码就行

7. Restart the redis client to connect to redis

[root@VM_0_17_centos /]# service redis restart
[root@VM_0_17_centos src]# ./redis-cli -h 127.0.0.1 -p 6379 -a password
# -a 后面就是设置的密码

 

 

Guess you like

Origin blog.csdn.net/qq_22420441/article/details/87525594