当前位置:网站首页>(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 redischmod 755 redis-install.sh && sh redis-install.sh 4.0.10
Collected from the Internet , For reference only
边栏推荐
- If you open an account of Huatai Securities by stock speculation, is it safe to open an account online?
- How to reduce the stock account Commission and stock speculation commission? Is it safe to open an online account
- How to apply for PMP project management certification examination?
- Consolidated expression C case simple variable operation
- PMP证书续证流程
- Hisilicon 3559 universal platform construction: YUV422 pit stepping record
- In the enterprise, win10 turns on BitLocker to lock the disk, how to back up the system, how to recover when the system has problems, and how to recover quickly while taking into account system securi
- Using fast parsing intranet penetration to realize zero cost self built website
- go踩坑——no required module provides package : go.mod file not found in current directory or any parent
- Illustrated network: what is gateway load balancing protocol GLBP?
猜你喜欢

How long does it take to obtain a PMP certificate?
![[IELTS reading] Wang Xiwei reading P4 (matching1)](/img/91/1b3f85410035f65acb0c205185f698.png)
[IELTS reading] Wang Xiwei reading P4 (matching1)

Summer challenge brings you to play harmoniyos multi terminal piano performance

「运维有小邓」域密码策略强化器

js如何实现数组转树

青海省国家湿地公园功能区划数数据、全国湿地沼泽分布数据、全国省市县自然保护区

微服务(Microservice)那点事儿

PMP certificate renewal process

业务场景功能的继续修改

Hash table, hash function, bloom filter, consistency hash
随机推荐
Is it safe to open an account in the College of Finance and economics? How to open an account?
【雅思阅读】王希伟阅读P3(Heading)
同事的接口文档我每次看着就头大,毛病多多。。。
P4281 [ahoi2008] emergency assembly / gathering (LCA)
The waterfall flow layout demo2 (method 2) used by the uniapp wechat applet (copy and paste can be used without other processing)
Power operation and maintenance cloud platform: open the new mode of "unattended and few people on duty" of power system
[IELTS reading] Wang Xiwei reading P3 (heading)
Go step on the pit - no required module provides package: go mod file not found in current directory or any parent
【报错】 “TypeError: Cannot read properties of undefined (reading ‘split‘)“
Five papers recommended for the new development of convolutional neural network in deep learning
P3304 [SDOI2013]直径(树的直径)
How long does it take to obtain a PMP certificate?
《论文笔记》Multi-UAV Collaborative Monocular SLAM
How to apply for PMP project management certification examination?
他做国外LEAD,用了一年时间,把所有房贷都还清了
Every time I look at the interface documents of my colleagues, I get confused and have a lot of problems...
Consolidated expression C case simple variable operation
Detailed explanation of openharmony resource management
js如何实现数组转树
业务场景功能的继续修改