当前位置:网站首页>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 :
边栏推荐
- 什么是权限?什么是角色?什么是用户?
- Ospfb notes - five messages [ultra detailed] [Hello message, DD message, LSR message, LSU message, lsack message]
- Embedded System Development Notes 80: using QT designer to design the main interface
- Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services
- Web server: how to choose a good web server these five aspects should be paid attention to
- Mallbook: how can hotel enterprises break the situation in the post epidemic era?
- Shell之分析服务器日志命令集锦
- PgSQL failed to start after installation
- Daily question - line 10
- 尺取法:有效三角形的个数
猜你喜欢
![[ue4] event distribution mechanism of reflective event distributor and active call event mechanism](/img/44/6a26ad24d56ddd5156f3a31fa7e0b9.jpg)
[ue4] event distribution mechanism of reflective event distributor and active call event mechanism

Procurement intelligence is about to break out, and Alipay'3+2'system helps enterprises build core competitive advantages

25.k sets of flipped linked lists

TASK04|数理统计

Extension fragment

Task04 | statistiques mathématiques

Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security

TCP server communication flow

LM小型可编程控制器软件(基于CoDeSys)笔记十九:报错does not match the profile of the target

It's settled! 2022 JD cloud summit of JD global technology Explorer conference see you in Beijing on July 13
随机推荐
Tip of edge browser: enter+ctrl can automatically convert the address bar into a web address
[deep learning] (4) decoder mechanism in transformer, complete pytoch code attached
[pat (basic level) practice] - [simple simulation] 1064 friends
Tencent has five years of testing experience. It came to the interview to ask for 30K, and saw the so-called software testing ceiling
JVM栈和堆简介
LM小型可编程控制器软件(基于CoDeSys)笔记十九:报错does not match the profile of the target
TASK04|数理统计
How to do the performance pressure test of "Health Code"
VIM简易使用教程
Use winmtr software to simply analyze, track and detect network routing
[difficult] sqlserver2008r2, can you recover only some files when recovering the database?
slf4j 简单实现
Embedded System Development Notes 79: why should I get the IP address of the local network card
Hololens2 development environment building and deploying apps
Common interview questions ①
2. Use of classlist (element class name)
Odeint and GPU
Account sharing technology enables the farmers' market and reshapes the efficiency of transaction management services
Collect the annual summary of laws, regulations, policies and plans related to trusted computing of large market points (national, ministerial, provincial and municipal)
[learn C and fly] S1E20: two dimensional array