Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The whole process of redis4.0.11 installation available in production environment

2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The whole process of redis4.0.11 installation available in production environment

The operating system version is centos6.5

First execute the initialization.sh optimization script. For more information, please see initialization script.

We use redis-4.0.11.tar.gz online.

Optimize / / withdraw cash according to the contents of the log. We can execute it first here. Students who don't understand can continue to look back.

Optimization 1: [root @ prd3-redis01-10-183 conf] # echo "vm.overcommit_memory = 1" > > / etc/sysctl.conf [root@prd3-redis01-10-183 conf] # sysctl-p Optimization 2: [root @ prd3-redis01-10-183 conf] # echo "net.core.somaxconn = 511" > > / etc/sysctl.conf [root@prd3-redis01-10-183 conf] # sysctl-p Optimization 3: another is to close the transparent large page, which we did in the optimization script.

Step 1: execute the optimization script initialization.sh

Step 2: download the installation package for redis

[root@prd3-redis01-10-183 opt] # wget http://download.redis.io/releases/redis-4.0.11.tar.gz

Step 3: download the necessary dependencies: yum install-y tcl tcl-devel

[root@prd3-redis01-10-183 opt] # yum install-y tcl tcl-devel

Tip: an error occurred during installation: the solution is as follows

An error occurred while executing make & & make install while installing redis

Make [3]: gcc: Command not found

/ bin/sh: cc: command not found

[root@mysql-redis-mgdb redis-4.0.11] # yum-y install gcc+ gcc-c++

Then you need to delete the extracted redis package, re-compress it, and execute make & & make install again.

Step 4: create related directories

[root@prd3-redis01-10-183 opt] # mkdir-p / ivargo/ {app,log}

[root@prd3-redis01-10-183 opt] # cd / ivargo/

[root@prd3-redis01-10-183 ivargo] # ll

Total 8

Drwxr-xr-x 2 root root 4096 Apr 24 15:16 app

Drwxr-xr-x 2 root root 4096 Apr 24 15:16 log

[root@prd3-redis01-10-183 ivargo] # cd app/

[root@prd3-redis01-10-183 app] # mkdir redis sentinel

[root@prd3-redis01-10-183 app] # ll

Total 8

Drwxr-xr-x 2 root root 4096 Apr 24 15:18 redis

Drwxr-xr-x 2 root root 4096 Apr 24 15:18 sentinel

[root@prd3-redis01-10-183 app] # cd redis/

[root@prd3-redis01-10-183 redis] # mkdir conf data log

[root@prd3-redis01-10-183 redis] # ll

Total 12

Drwxr-xr-x 2 root root 4096 Apr 24 15:19 conf

Drwxr-xr-x 2 root root 4096 Apr 24 15:19 data

Drwxr-xr-x 2 root root 4096 Apr 24 15:19 log

[root@prd3-redis01-10-183 app] # cd sentinel/

[root@prd3-redis01-10-183 sentinel] # ll

Total 0

[root@prd3-redis01-10-183 sentinel] # mkdir conf

[root@prd3-redis01-10-183 ivargo] # pwd

/ ivargo

[root@prd3-redis01-10-183 ivargo] # tree

.

├── app

│ ├── redis

│ │ ├── conf

│ │ ├── data

│ │ └── log

│ └── sentinel

│ └── conf

└── log

Step 5: install redis

[root@prd3-redis01-10-183 ivargo] # cd / opt/

[root@prd3-redis01-10-183 opt] # ll

Total 1708

-rw-r--r-- 1 root root 1739656 Aug 4 2018 redis-4.0.11.tar.gz

Drwxr-xr-x. 2 root root 4096 Nov 22 2013 rh

Drwxr-xr-x 2 root root 4096 Apr 24 2019 scripts

[root@prd3-redis01-10-183 opt] # tar zxvf redis-4.0.11.tar.gz

[root@prd3-redis01-10-183 opt] # cd redis-4.0.11

[root@prd3-redis01-10-183 redis-4.0.11] # make & & make install

...

...

...

Step 6: upload the configuration file to

[root@prd3-redis01-10-183 conf] # pwd

/ ivargo/app/redis/conf

[root@prd3-redis01-10-183 conf] # ll

Total 4

-rw-r--r-- 1 root root 3946 Apr 24 15:28 6379.conf

Step 7: start redis

[root@prd3-redis01-10-183 conf] # redis-server / ivargo/app/redis/conf/6379.conf

[root@prd3-redis01-10-183 conf] # netstat-lntup

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

Tcp 0 0 0.0.0.0:6379 0.0.0.0: LISTEN 5195/redis-server 0

Tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 1543/sshd

Tcp 0 0 127.0.0.1:25 0.0.0.0: LISTEN 1619/master

Tcp 0 0: 22: LISTEN 1543/sshd

Tcp 0 0:: 1:25: * LISTEN 1619/master

[root@prd3-redis01-10-183 conf] # ps-ef | grep redis

Root 5195 1 0 15:34? 00:00:00 redis-server 0.0.0.0:6379

Root 5201 1709 0 15:35 pts/0 00:00:00 grep-color=auto redis

Step 8 check redis

[root@prd3-redis01-10-183 log] # vim 6379.log

5194:C 24 Apr 15:34:51.909 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo

5194:C 24 Apr 15:34:51.909 # Redis version=4.0.11, bits=64, commit=00000000, modified=0, pid=5194, just started

5194:C 24 Apr 15:34:51.909 # Configuration loaded

5195:M 24 Apr 15:34:51.935 Running mode=standalone, port=6379.

5195:M 24 Apr 15:34:51.935 # WARNING: The TCP backlog setting of 511 cannot be enforced because / proc/sys/net/c

Ore/somaxconn is set to the lower value of 128.

5195:M 24 Apr 15:34:51.935 # Server initialized

5195:M 24 Apr 15:34:51.935 # WARNING overcommit_memory is set to 0! Background save may fail under low memory c

Ondition. To fix this issue add 'vm.overcommit_memory = 1' to / etc/sysctl.conf and then reboot or run the comma

Nd 'sysctl vm.overcommit_memory=1' for this to take effect.

5195 Apr M 24 Apr 15 support enabled in your kernel 34 support enabled in your kernel 51.935 # WARNING you have Transparent Huge Pages (THP) This

Will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > / sys/k

Ernel/mm/transparent_hugepage/enabled' as root, and add it to your / etc/rc.local in order to retain the setting

After a reboot. Redis must be restarted after THP is disabled.

5195:M 24 Apr 15:34:51.935 Ready to accept connections

Optimize according to log content

Optimization 1:

[root@prd3-redis01-10-183 conf] # echo "vm.overcommit_memory = 1" > > / etc/sysctl.conf

[root@prd3-redis01-10-183 conf] # sysctl-p

Optimization 2:

[root@prd3-redis01-10-183 conf] # echo "net.core.somaxconn = 511" > > / etc/sysctl.conf

[root@prd3-redis01-10-183 conf] # sysctl-p

Optimization 3:

Another is to close the transparent page, which we did in the optimization script.

A gentle way to shut down redis

[root@web03 ~] # redis-server / ivargo/app/redis/conf/6379.conf

[root@web03 ~] # ps-ef | grep redis

Root 1718 1 0 18:31? 00:00:00 redis-server 0.0.0.0:6379

Root 1723 1693 0 18:31 pts/0 00:00:00 grep-color=auto redis

[root@web03] # redis-cli-a xxx

Warning: Using a password with'- a 'option on the command line interface may not be safe.

127.0.0.1 shutdown 6379 > method of gently shutting down redis

Not connected >

[root@web03 ~] # ps-ef | grep redis

Root 1727 1693 0 18:32 pts/0 00:00:00 grep-color=auto redis

[root@prd3-redis01-10-183 conf] # sh / etc/rc.local

Start redis again and there will be no alarm.

At this point, we have installed redis. Next, we will implement the sentinel architecture of redis. Please look forward to

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report