当前位置:网站首页>(script) one click deployment of any version of redis - the way to build a dream
(script) one click deployment of any version of redis - the way to build a dream
2022-07-05 00:09:00 【The road to dream】
#!/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
chmod 755 redis-install.sh && sh redis-install.sh 4.0.10
Collected from the Internet , For reference only
边栏推荐
- [ODX studio edit PDX] -0.3- how to delete / modify inherited elements in variant variants
- The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
- 人生无常,大肠包小肠, 这次真的可以回家看媳妇去了。。。
- 使用快解析搭建自己的minecraft服务器
- Application of fire fighting system based on 3D GIS platform
- 香港珠宝大亨,22亿“抄底”佐丹奴
- Basic points of the game setup of the points mall
- 【雅思阅读】王希伟阅读P3(Heading)
- Skills in analyzing the trend chart of London Silver
- P3304 [SDOI2013]直径(树的直径)
猜你喜欢
快解析内网穿透帮助企业快速实现协同办公
Fast parsing intranet penetration helps enterprises quickly achieve collaborative office
多回路仪表在基站“转改直”方面的应用
他做国外LEAD,用了一年时间,把所有房贷都还清了
Using fast parsing intranet penetration to realize zero cost self built website
Parsing of XML
IELTS examination process, what to pay attention to and how to review?
How to avoid arc generation—— Aafd fault arc detector solves the problem for you
Mit-6.824-lab4b-2022 (10000 word idea explanation - code construction)
S32 design studio for arm 2.2 quick start
随机推荐
股票账户佣金怎么调低,炒股佣金怎么调低网上开户安全吗
Some basic functions of enterprise projects are developed, and important things are saved to online first a
【路径规划】RRT增加动力模型进行轨迹规划
Expand your kubecl function
He worked as a foreign lead and paid off all the housing loans in a year
[paper reading] cavemix: a simple data augmentation method for brain vision segmentation
Continuous modification of business scenario functions
[论文阅读] TUN-Det: A Novel Network for Thyroid Ultrasound Nodule Detection
Life is changeable, and the large intestine covers the small intestine. This time, I can really go home to see my daughter-in-law...
The input of uniapp is invalid except for numbers
Hash table, hash function, bloom filter, consistency hash
S32 design studio for arm 2.2 quick start
基于三维gis平台的消防系统运用
A new method for analyzing the trend chart of London Silver
跨域请求
Verilog tutorial (11) initial block in Verilog
IT转测试岗,从迷茫到坚定我究竟付出了什么?
使用快解析搭建自己的minecraft服务器
业务实现-日志写到同一个行数据里面
[IELTS reading] Wang Xiwei reading P4 (matching1)