当前位置:网站首页>One click shell to automatically deploy any version of redis
One click shell to automatically deploy any version of redis
2022-07-01 04:38:00 【Moshow Zhengkai】
Script usage :chmod 755 redis-install.sh && sh redis-install.sh {version} ( Back {version} What you need is the version number , Write the version you need ), I have installed 4.0.10
The script is shown below :
#! /usr/bin/bash
##redis Any version of the full automatic source code compilation and installation
## usage :sh redis-install.sh 4.0.10 ( Followed by the version number you need , Write the version you need ), I have installed 4.0.10
version=$1
usage(){
echo "usage: $0 version"
}
if [ $# -ne 1 ]
then
usage
exit -1
fi
#Redis Installation package download
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 Dependent package installation
yum clean all
yum makecache fast
yum -y install gcc gcc-c++ tcl
# compile Redis The required 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
## Kernel optimization of internal system parameters
cat >> /etc/rc.d/rc.local << "EOF" ## close Linux Of THP( Memory management system ) By using larger memory pages , To reduce TLB The cost of 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 EOF
chmod u+x /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 << "EOF" #Linux System kernel parameter optimization net.core.somaxconn = 2048 net.ipv4.tcp_max_syn_backlog = 2048 vm.overcommit_memory = 1 EOF
sysctl -p
cat > /etc/security/limits.conf << "EOF" root soft nofile 65535 root hard nofile 65535 * soft nofile 65535 * hard nofile 65535 EOF
#Redis Compilation and installation
cd /usr/local/src
tar -zxvf redis-${version}.tar.gz
cd /usr/local/src/redis-${version}
make
make PREFIX=/usr/local/redis install
#Redis Basic configuration
mkdir -p /usr/local/redis/{
etc,logs,data}
egrep -v "^$|^#" /usr/local/src/redis-${version}/redis.conf > /usr/local/redis/etc/redis.conf
#sed -i "s/bind 127.0.0.1/bind 0.0.0.0/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\/redis\/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 To configure
echo "export PATH=${
PATH}:/usr/local/redis/bin" >>/etc/profile
source /etc/profile
# start-up redis service
/usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf
# see redis Listening port
netstat -tanp|grep redis


So far, the automatic installation script has been successfully executed , We can receive it through ps –ef|grep redis To view the service status and monitor ports .
land redis, Execute simple statements :
边栏推荐
- MySQL function variable stored procedure
- Grey correlation cases and codes
- JD intelligent customer service Yanxi intention system construction and intention recognition technology introduction
- JS rotation chart
- Possible problems and solutions of using scroll view to implement slider view
- In the innovation community, the "100 cities Tour" of the gold warehouse of the National People's Congress of 2022 was launched
- [human version] Web3 privacy game in the dark forest
- Registration for R2 mobile pressure vessel filling test in 2022 and R2 mobile pressure vessel filling free test questions
- MySQL advanced -- you will have a new understanding of MySQL
- Applications and features of VR online exhibition
猜你喜欢

LM small programmable controller software (based on CoDeSys) note 19: errors do not match the profile of the target

2022.2.7-2.13 AI industry weekly (issue 84): family responsibilities

Execution failed for task ‘:app:processDebugResources‘. > A failure occurred while executing com. and

Concurrent mode of different performance testing tools
![[learn C and fly] S1E20: two dimensional array](/img/68/34fad73ff23d3e0719ef364fc60cb5.jpg)
[learn C and fly] S1E20: two dimensional array

How to do the performance pressure test of "Health Code"

【LeetCode】100. Same tree
![[pat (basic level) practice] - [simple simulation] 1064 friends](/img/37/0ef0f8aae15ae574be1d76c97497c9.jpg)
[pat (basic level) practice] - [simple simulation] 1064 friends

Possible problems and solutions of using scroll view to implement slider view

Custom components in applets
随机推荐
Learn Chapter 20 of vue3 (keep alive cache component)
Odeint et GPU
Obtain detailed ideas for ABCDEF questions of 2022 American Games
How to view the changes and opportunities in the construction of smart cities?
This may be your last chance to join Tencent
VIM简易使用教程
C language games (I) -- guessing games
"Target detection" + "visual understanding" realizes the understanding of the input image
2022年上海市安全员C证考试题模拟考试题库及答案
Qt development experience tips 226-230
2022 polymerization process test questions and simulation test
【深度学习】(4) Transformer 中的 Decoder 机制,附Pytorch完整代码
Maixll dock quick start
What is uid? What is auth? What is a verifier?
Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security
Introduction of Spock unit test framework and its practice in meituan optimization___ Chapter I
[godot] unity's animator is different from Godot's animplayer
Annual inventory review of Alibaba cloud's observable practices in 2021
OdeInt与GPU
Seven crimes of counting software R & D Efficiency