Centos 6.8
cd /opt
wget http://download.redis.io/releases/redis-3.0.5.tar.gz
tar zxvf redis-3.0.5.tar.gz
cd redis-3.0.5
make && make install
mkdir /etc/redis
mkdir /var/log/redis
mkdir -p /data/redis
cd /opt/redis-3.0.5
cp redis.conf /etc/redis/7963.conf
vi /etc/redis/7963.conf
daemonize no
port 6379
logfile “”
pidfile /var/run/redis.pid
# requirepass foobared
dir ./
??
daemonize yes
port 7963
logfile “/var/log/redis/7963.log”
pidfile /var/run/redis_7963.pid
requirepass 9k3NgZq%gO!W7x-0y=LI
dir /data/redis
sed -i “s/daemonize no/daemonize yes/g” /etc/redis/7963.conf
sed -i “s/port 6379/port 7963/g” /etc/redis/7963.conf
sed -i “s/pidfile \/var\/run\/redis.pid/pidfile \/var\/run\/redis_7963.pid/g” /etc/redis/7963.conf
sed -i “s/logfile \”\”/logfile \”\/var\/log\/redis\/7963.log\”/g” /etc/redis/7963.conf
sed -i “s/# requirepass foobared/requirepass 9k3NgZq%gO!W7x-0y=LI/g” /etc/redis/7963.conf
sed -i “s/dir .\//dir \/data\/redis/g” /etc/redis/7963.conf
grep vm.overcommit_memory /etc/sysctl.conf
echo “vm.overcommit_memory = 1” >> /etc/sysctl.conf
sed -i “s/vm.overcommit_memory = 0/vm.overcommit_memory = 1/g” /etc/sysctl.conf
sysctl -p
cd /opt/redis-3.0.5
cp utils/redis_init_script /etc/init.d/redis
vi /etc/init.d/redis
vi /etc/init.d/redis
———————————–
# chkconfig: 2345 90 10
# description: Simple Redis init.d scrip
REDISPORT=6379
REDISPORT=7963
CONF=”/etc/redis/${REDISPORT}.conf”
PASS=`grep “requirepass ” $CONF | awk {print’$2′}`
$CLIEXEC -p $REDISPORT shutdown
if [ -z “$PASS” ]
then
$CLIEXEC -p $REDISPORT shutdown
else
$CLIEXEC -p $REDISPORT -a $PASS shutdown
fi
sed -i “1 a # chkconfig: 2345 90 10” /etc/init.d/redis
sed -i “2 a # description: Simple Redis init.d scrip” /etc/init.d/redis
sed -i “s/REDISPORT=6379/REDISPORT=7963/g” /etc/init.d/redis
sed -i $’13 a PASS=`grep “requirepass ” $CONF | awk {print\’$2\’}`’ /etc/init.d/redis
sed -i “s/PORT shutdown/PORT -a \$PASS shutdown/g” /etc/init.d/redis
Redis
chkconfig redis on
chkconfig –list redis
service redis start
service redis stop
CentOS 7 Redis
## RHEL/CentOS 7 64-Bit ##
wget http://dl.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
yum repolist
yum -y update
yum install redis php-pecl-redis
systemctl start redis-server.service
systemctl enable redis-server.service
systemctl is-active redis-server.service
phpRedisAdmin RedisWeb Redis
git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
cd phpRedisAdmin/includes
cp config.sample.inc.php config.inc.php
# nano config.inc.php
RedisAdmin???????Apache
### nano /etc/httpd/conf.d/redisadmin.conf
### Now add the following ###
#
# Web Interface for RedisAdmin
#
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from
Alias /redisAdmin /downloads/phpRedisAdmin
Alias /redisadmin /downloads/phpRedisAdmin
### nano /scripts/redis-check.sh
#!/bin/bash
PS=$(which ps)
GREP=$(which grep)
WHEN=$(date +”%Y-%m-%d-%H:%M:%S”)
if ! $PS aux | $GREP “redis.conf” | $GREP -v grep 2>&1 > /dev/null; then
/etc/init.d/redis restart
echo ‘Restarted Redis @’ $WHEN
fi
#Check Second instance
if ! $PS aux | $GREP “redis2.conf” | $GREP -v grep 2>&1 > /dev/null; then
/etc/init.d/redis2 restart
echo ‘Restarted Redis2 @’ $WHEN
fi
chmod +x /scripts/redis-check.sh
### nano /var/spool/cron/root
*/3 * * * * /bin/bash /script/redis-check.sh >> /var/log/redis-check.log
http://www.linuxidc.com/Linux/2016-06/132687.htm
tar xf redis-3.0.7.tar.gz -C /usr/local
mv redis-3.0.7 redis
cd /usr/local
make
make install
cp utils/redis_init_script /etc/init.d/redis
vim /etc/init.d/redis
# chkconfig: 2345 88 45
chmod +x /etc/init.d/redis
chkconfig –add redis
vim /usr/local/redis/redis.conf
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
port 7001
logfile “redis_7001.log”
dir “/data/redis/7001”
appendonly yes #????aof
mkdir /etc/redis/{7001,7002} -pv
mkdir /data/redis/{7001,7002} -pv
mkdir /etc/redis/{7003,7004} -pv
mkdir /data/redis/{7003,7004} -pv
mkdir /etc/redis/{7005,7006} -pv
mkdir /data/redis/{7005,7006} -pv
cd /etc/redis
sed ‘s/6379/7001/g’ /usr/local/redis/redis.conf > /etc/redis/7001/redis.conf
sed ‘s/6379/7002/g’ /usr/local/redis/redis.conf > /etc/redis/7002/redis.conf
sed ‘s/6379/7003/g’ /usr/local/redis/redis.conf > /etc/redis/7003/redis.conf
sed ‘s/6379/7004/g’ /usr/local/redis/redis.conf > /etc/redis/7004/redis.conf
sed ‘s/6379/7005/g’ /usr/local/redis/redis.conf > /etc/redis/7005/redis.conf
sed ‘s/6379/7006/g’ /usr/local/redis/redis.conf > /etc/redis/7006/redis.conf
/usr/local/redis/src/redis-server /etc/redis/700[1-6]/redis.conf
yum -y install ruby rubygems
gem install redis
cp /usr/local/redis/src/redis-trib.rb /usr/bin/redis-trib
redis-trib create –replicas 1 192.168.130.242:7001 192.168.130.242:7002
192.168.130.243:7003 192.168.130.243:7004 192.168.130.244:7005 192.168.130.244:7006
Centos 6.8
cd /opt
wget http://download.redis.io/releases/redis-3.0.5.tar.gz
tar zxvf redis-3.0.5.tar.gz
cd redis-3.0.5
make && make install
mkdir /etc/redis
mkdir /var/log/redis
mkdir -p /data/redis
cd /opt/redis-3.0.5
cp redis.conf /etc/redis/7963.conf
vi /etc/redis/7963.conf
daemonize no
port 6379
logfile “”
pidfile /var/run/redis.pid
# requirepass foobared
dir ./
??
daemonize yes
port 7963
logfile “/var/log/redis/7963.log”
pidfile /var/run/redis_7963.pid
requirepass 9k3NgZq%gO!W7x-0y=LI
dir /data/redis
sed -i “s/daemonize no/daemonize yes/g” /etc/redis/7963.conf
sed -i “s/port 6379/port 7963/g” /etc/redis/7963.conf
sed -i “s/pidfile \/var\/run\/redis.pid/pidfile \/var\/run\/redis_7963.pid/g” /etc/redis/7963.conf
sed -i “s/logfile \”\”/logfile \”\/var\/log\/redis\/7963.log\”/g” /etc/redis/7963.conf
sed -i “s/# requirepass foobared/requirepass 9k3NgZq%gO!W7x-0y=LI/g” /etc/redis/7963.conf
sed -i “s/dir .\//dir \/data\/redis/g” /etc/redis/7963.conf
grep vm.overcommit_memory /etc/sysctl.conf
echo “vm.overcommit_memory = 1” >> /etc/sysctl.conf
sed -i “s/vm.overcommit_memory = 0/vm.overcommit_memory = 1/g” /etc/sysctl.conf
sysctl -p
cd /opt/redis-3.0.5
cp utils/redis_init_script /etc/init.d/redis
vi /etc/init.d/redis
vi /etc/init.d/redis
———————————–
# chkconfig: 2345 90 10
# description: Simple Redis init.d scrip
REDISPORT=6379
REDISPORT=7963
CONF=”/etc/redis/${REDISPORT}.conf”
PASS=`grep “requirepass ” $CONF | awk {print’$2′}`
$CLIEXEC -p $REDISPORT shutdown
if [ -z “$PASS” ]
then
$CLIEXEC -p $REDISPORT shutdown
else
$CLIEXEC -p $REDISPORT -a $PASS shutdown
fi
sed -i “1 a # chkconfig: 2345 90 10” /etc/init.d/redis
sed -i “2 a # description: Simple Redis init.d scrip” /etc/init.d/redis
sed -i “s/REDISPORT=6379/REDISPORT=7963/g” /etc/init.d/redis
sed -i $’13 a PASS=`grep “requirepass ” $CONF | awk {print\’$2\’}`’ /etc/init.d/redis
sed -i “s/PORT shutdown/PORT -a \$PASS shutdown/g” /etc/init.d/redis
Redis
chkconfig redis on
chkconfig –list redis
service redis start
service redis stop
CentOS 7 Redis
## RHEL/CentOS 7 64-Bit ##
wget http://dl.Fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
yum repolist
yum -y update
yum install redis php-pecl-redis
systemctl start redis-server.service
systemctl enable redis-server.service
systemctl is-active redis-server.service
phpRedisAdmin RedisWeb Redis
git clone https://github.com/ErikDubbelboer/phpRedisAdmin.git
cd phpRedisAdmin/includes
cp config.sample.inc.php config.inc.php
# nano config.inc.php
RedisAdmin???????Apache
### nano /etc/httpd/conf.d/redisadmin.conf
### Now add the following ###
#
# Web Interface for RedisAdmin
#
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
Allow from
Alias /redisAdmin /downloads/phpRedisAdmin
Alias /redisadmin /downloads/phpRedisAdmin
### nano /scripts/redis-check.sh
#!/bin/bash
PS=$(which ps)
GREP=$(which grep)
WHEN=$(date +”%Y-%m-%d-%H:%M:%S”)
if ! $PS aux | $GREP “redis.conf” | $GREP -v grep 2>&1 > /dev/null; then
/etc/init.d/redis restart
echo ‘Restarted Redis @’ $WHEN
fi
#Check Second instance
if ! $PS aux | $GREP “redis2.conf” | $GREP -v grep 2>&1 > /dev/null; then
/etc/init.d/redis2 restart
echo ‘Restarted Redis2 @’ $WHEN
fi
chmod +x /scripts/redis-check.sh
### nano /var/spool/cron/root
*/3 * * * * /bin/bash /script/redis-check.sh >> /var/log/redis-check.log
http://www.linuxidc.com/Linux/2016-06/132687.htm
tar xf redis-3.0.7.tar.gz -C /usr/local
mv redis-3.0.7 redis
cd /usr/local
make
make install
cp utils/redis_init_script /etc/init.d/redis
vim /etc/init.d/redis
# chkconfig: 2345 88 45
chmod +x /etc/init.d/redis
chkconfig –add redis
vim /usr/local/redis/redis.conf
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 5000
port 7001
logfile “redis_7001.log”
dir “/data/redis/7001”
appendonly yes #????aof
mkdir /etc/redis/{7001,7002} -pv
mkdir /data/redis/{7001,7002} -pv
mkdir /etc/redis/{7003,7004} -pv
mkdir /data/redis/{7003,7004} -pv
mkdir /etc/redis/{7005,7006} -pv
mkdir /data/redis/{7005,7006} -pv
cd /etc/redis
sed ‘s/6379/7001/g’ /usr/local/redis/redis.conf > /etc/redis/7001/redis.conf
sed ‘s/6379/7002/g’ /usr/local/redis/redis.conf > /etc/redis/7002/redis.conf
sed ‘s/6379/7003/g’ /usr/local/redis/redis.conf > /etc/redis/7003/redis.conf
sed ‘s/6379/7004/g’ /usr/local/redis/redis.conf > /etc/redis/7004/redis.conf
sed ‘s/6379/7005/g’ /usr/local/redis/redis.conf > /etc/redis/7005/redis.conf
sed ‘s/6379/7006/g’ /usr/local/redis/redis.conf > /etc/redis/7006/redis.conf
/usr/local/redis/src/redis-server /etc/redis/700[1-6]/redis.conf
yum -y install ruby rubygems
gem install redis
cp /usr/local/redis/src/redis-trib.rb /usr/bin/redis-trib
redis-trib create –replicas 1 192.168.130.242:7001 192.168.130.242:7002
192.168.130.243:7003 192.168.130.243:7004 192.168.130.244:7005 192.168.130.244:7006
Recent Comments