Linux novice to configure the deployment _ (d) - Redis Installation and Configuration

Foreword

After you finish configuring mysql, we immediately install redis, after all, not too much thinking, that is, command execution, configuration files, test the connection.

installation

First, we look at which version is installed, you can Redis official website to see which version we installed.

When using wget before, and I always thought that would put the default download folder, who knows a look, it turned out to be where execution on where to download, pay attention here at

[root@april tmp]# wget http://download.redis.io/releases/redis-5.0.5.tar.gz

[root@april tmp]# tar -zxvf redis-5.0.5.tar.gz -C /usr/local/

After the extraction is completed we look at whether there are dependencies gcc, after all, to use the make command to compile it.

[root@april tmp]# gcc -v
bash: gcc: command not found...
[root@april tmp]# sudo yum install -y gcc

After installing dependencies, we begin to change directories to compile.

[root@april tmp]# cd /usr/local/redis-5.0.5/
[root@april redis-5.0.5]# make MALLOC=libc 
[root@april redis-5.0.5]# cd src && make install

After compilation, we started to run it and see it.

[root@april src]# ./redis-server 

test

OK, after the run is completed, we started to look at the configuration of it.

 #将值改为yes
daemonize yes  

# 注释掉它,以便让外网访问
# bind 127.0.0.1
 
# 关闭保护模式
protected-mode no

# 当Redis以守护进程方式运行时,Redis默认会把pid写入/var/run/redis.pid文件,可以通过pidfile指定
pidfile /var/run/redis_6379.pid

# 指定Redis监听端口,默认端口为6379
# 如果指定0端口,表示Redis不监听TCP连接
port 6379

# 注意,这里只能指定一个目录,不能指定文件名
dir /var/redis/6379

Once saved, we start to set redis background, boot, province of each adjustment.

[root@april redis-5.0.5]# mkdir /etc/redis
[root@april redis-5.0.5]# cp /usr/local/redis-5.0.5/redis.conf /etc/redis/6379.conf
[root@april redis-5.0.5]# cp /usr/local/redis-5.0.5/utils/redis_init_script /etc/init.d/redisd
# 切换到服务目录
[root@april redis-5.0.5]# cd /etc/init.d/
[root@april init.d]# chkconfig redisd on
# 校验通过后我们就可以像操作服务一样了
[root@april init.d]# service redisd start

When finished, remember we turned down the firewall.

[root@april init.d]# firewall-cmd --permanent --add-port=6379/tcp
success
[root@april init.d]# firewall-cmd --reload

test

test

Just add a key-value pair to try.
test

summary

After Redis configuration is complete, down to basic engineering will first be used to make the connection redis example, the road is long, there are many things to tinker with.

Guess you like

Origin www.cnblogs.com/AprilBlank/p/11514472.html