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

What script can be used to automatically deploy any version of Redis with one click?

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Today, I will talk to you about what script can be used to automatically deploy any version of Redis. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Today, I would like to share with you a super useful script that automatically installs and deploys any version of Redis with one click. Remember that it is any version!

Script usage: chmod 755 redis-install.sh & & sh redis-install.sh 4.0.10 (followed by the version number you need, write whatever version you need), 4.0.10 installed here

The specific content of the script is shown as follows:

#! / usr/bin/bash # # redis any version fully automated source code compilation installation # # usage: sh redis-install.sh 4.0.10 (followed by the version number you need, write whatever version you need) The 4.0.10 version=$1 usage () {echo "usage: $0 version"} if [$#-ne 1] then usage exit-1 fi # Redis installation package I installed here downloads cd / usr/local/src if [!-f redis-$ {version} .tar.gz] then curl-o / usr/local/src/redis-$ {version} .tar.gz http://download.redis.io/releases/redis-${version}.tar.gz fi # Redis dependency package installs yum clean all yum makecache fast yum-y install gcc gcc-c++ tcl # gcc yum-y install centos-release-scl yum-y install devtoolset-9-gcc devtoolset-9-gcc-c++ devtoolset-9-binutils source / opt/rh/devtoolset-9/enable echo "source / opt/rh/devtoolset-9/enable" > > / etc/profile gcc--version # # system parameters kernel optimization cat > > / etc/rc.d/rc.local / Sys/kernel/mm/transparent_hugepage/enabled fi if [- f / sys/kernel/mm/transparent_hugepage/defrag] then echo never > / sys/kernel/mm/transparent_hugepage/defrag fi EOF chmod uplix / etc/rc.d/rc.local if [- f / sys/kernel/mm/transparent_hugepage/enabled] then echo never > / sys/kernel/mm/transparent_hugepage/enabled fi if [- f / sys/kernel/mm/transparent_hugepage/defrag] then echo never > / sys/ Kernel/mm/transparent_hugepage/defrag fi cat > > / etc/sysctl.conf / etc/security/limits.conf / usr/local/redis/etc/redis.conf # sed-I "s/bind 127.0.0.1/bind 0.0.0.0 s/protected-mode yes/protected-mode no/g g" / usr/local/redis/etc/redis.conf sed-I "s/protected-mode yes/protected-mode no/g" / usr/local/redis/etc/redis.conf sed-I "s/daemonize no/ Daemonize yes/g "/ usr/local/redis/etc/redis.conf sed-I" s/pidfile\ / var\ / run\ / redis_6379.pid/pidfile\ / usr\ / local\ / redis\ / redis.pid/g "/ usr/local/redis/etc/redis.conf sed-I" s/dir\. / / dir\ / usr\ / local\ / redis\ / data/g "/ usr/local/redis/etc/redis.conf sed-I" s/logfile\ " \ "/ logfile\"\ / usr\ / local\ / logs\ / redis.log\ "/ g" / usr/local/redis/etc/redis.conf sed-I "s/dbfilename dump.rdb/dbfilename dump.rdb/g" / usr/local/redis/etc/redis.conf sed-I "s/appendfilename\" appendonly.aof\ "/ appendfilename\" appendonly.aof\ "/ g" / usr/local/redis/etc/redis.conf # PATH configure echo "export PATH=$ {PATH}: / usr/local/redis/bin "> > / etc/profile source / etc/profile # start redis service / usr/local/redis/bin/redis-server / usr/local/redis/etc/redis.conf # View redis listening port netstat-tanp | grep redis

Automatically install redis4.0.10 after executing the script

Automatically install the dependency packages required by Redis4.0.10, as shown in the following figure:

Automatically start decompression:

Start automatic make

Start automatic make install

The installation is complete and the Redis service has been started successfully:

After the automatic installation script for rectification and modification has been successfully executed, we can check the service status and listen on the port through ps-ef | grep redis.

Log in to redis and execute a simple statement:

After reading the above, do you have any further understanding of what script can be used to automatically deploy any version of Redis with one click? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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

Servers

Wechat

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

12
Report