当前位置:网站首页>One click deployment of any version of redis
One click deployment of any version of redis
2022-07-07 20:13:00 【Lingxiyun】
List of articles
Today I'd like to share with you a super practical script ,Linux One click automatic installation and deployment in environment Redis Any version of , Remember it's
Any version
Oh ! Script usage :
chmod 755 redis-install.sh && sh redis-install.sh 4.0.10
( Followed by the version number you need , Write the version you need ), I have installed4.0.10
Execute the script
#! /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
The installation process
Start automatic installation after executing the script redis4.0.10
Automatic installation Redis4.0.10 Required dependency packages , As shown in the figure below :
Automatically start decompression :
Start automatic make
Start automatic make install
installation is complete ,Redis Service started successfully :
So far, the entire automatic installation script has been successfully executed , We can receive it through ps –ef|grep redis To view the service status and monitor ports .
test
land redis, Execute simple statements :
边栏推荐
- MSE API学习
- Boot 和 Cloud 的版本选型
- 力扣 912.排序数组
- How to test CIS chip?
- Welcome to the markdown editor
- JVM class loading mechanism
- R language dplyr package select function, group_ The by function, filter function and do function obtain the third largest value of a specific numerical data column in a specified level in a specified
- Semantic slam source code analysis
- Traversal of Oracle stored procedures
- pom. XML configuration file label: differences between dependencies and dependencymanagement
猜你喜欢
About cv2 dnn. Readnetfromonnx (path) reports error during processing node with 3 inputs and 1 outputs [exclusive release]
剑指 Offer II 013. 二维子矩阵的和
【STL】vector
php 获取图片信息的方法
【哲思与实战】程序设计之道
Cloud 组件发展升级
Force buckle 599 Minimum index sum of two lists
With st7008, the Bluetooth test is completely grasped
大厂经典指针笔试题
Cloud component development and upgrading
随机推荐
LeetCode力扣(剑指offer 36-39)36. 二叉搜索树与双向链表37. 序列化二叉树38. 字符串的排列39. 数组中出现次数超过一半的数字
力扣674. 最长连续递增序列
关于cv2.dnn.readNetFromONNX(path)就报ERROR during processing node with 3 inputs and 1 outputs的解决过程【独家发布】
力扣 88.合并两个有序数组
vulnhub之tre1
Equals method
力扣 989. 数组形式的整数加法
剑指 Offer II 013. 二维子矩阵的和
831. KMP字符串
R language dplyr package mutate_ At function and min_ The rank function calculates the sorting sequence number value and ranking value of the specified data column in the dataframe, and assigns the ra
rk3128投影仪lcd显示四周显示不完整解决
Vulnhub tre1
BI的边界:BI不适合做什么?主数据、MarTech?该如何扩展?
PHP method of obtaining image information
How C language determines whether it is a 32-bit system or a 64 bit system
强化学习-学习笔记8 | Q-learning
力扣 1037.有效的回旋镖
整型int的拼接和拆分
国家网信办公布《数据出境安全评估办法》:累计向境外提供10万人信息需申报
Force buckle 88 Merge two ordered arrays