当前位置:网站首页>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 :
边栏推荐
- TCP server communication flow
- Caijing 365 stock internal reference | the first IPO of Beijing stock exchange; the subsidiary of the recommended securities firm for gambling and gambling, with a 40% discount
- 2022年煤气考试题库及在线模拟考试
- 扩展-Fragment
- 网站服务器:好用的网站服务器怎么选这五方面要关注
- Loop filtering based on Unet
- Annual inventory review of Alibaba cloud's observable practices in 2021
- [human version] Web3 privacy game in the dark forest
- 2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank
- Shell之一键自动部署Redis任意版本
猜你喜欢
![[deep learning] (4) decoder mechanism in transformer, complete pytoch code attached](/img/ec/96e3188902e399f536ebca79042af9.png)
[deep learning] (4) decoder mechanism in transformer, complete pytoch code attached

Section 27 remote access virtual private network workflow and experimental demonstration

Introduction of Spock unit test framework and its practice in meituan optimization___ Chapter I

Dual contractual learning: text classification via label aware data augmentation reading notes

Coinbase in a bear market: losses, layoffs, stock price plunges

It's settled! 2022 JD cloud summit of JD global technology Explorer conference see you in Beijing on July 13

2022危险化学品生产单位安全生产管理人员题库及答案

In the innovation community, the "100 cities Tour" of the gold warehouse of the National People's Congress of 2022 was launched

Loop filtering based on Unet

js 图片路径转换base64格式
随机推荐
扩展-Fragment
Tip of edge browser: enter+ctrl can automatically convert the address bar into a web address
Codeforces Round #721 (Div. 2)B1. Palindrome Game (easy version)B2. Palindrome game (hard version)
Common thread methods and daemon threads
Some small knowledge points
Odeint et GPU
[difficult] sqlserver2008r2, can you recover only some files when recovering the database?
Note de développement du système embarqué 80: application du concepteur Qt à la conception de l'interface principale
[Master / slave] router election in DD message
[learn C and fly] S1E20: two dimensional array
Valid @suppresswarnings warning name
Strategic suggestions and future development trend of global and Chinese vibration isolator market investment report 2022 Edition
一些小知识点
Leetcode learning - day 36
Embedded System Development Notes 81: Using Dialog component to design prompt dialog box
CUDA development and debugging tool
The junior college students were angry for 32 days, four rounds of interviews, five hours of soul torture, and won Ali's offer with tears
离线安装wireshark2.6.10
206. reverse linked list
Question bank and online simulation examination for special operation certificate of G1 industrial boiler stoker in 2022