redis银河麒麟安装

在ARM64系统上部署Redis
redis源码包下载并编译安装
redis已经自己写好了make file ,故不需要configure操作了

cd ~
wget http://download.redis.io/releases/redis-4.0.0.tar.gz
tar -xvf redis-4.0.0.tar.gz
cd redis-4.0.0
sudo mkdir /usr/local/redis
sudo make
sudo make PREFIX=/usr/local/redis install
sudo mkdir /usr/local/redis/etc
sudo cp ~/redis-4.0.0/redis.conf /usr/local/redis/etc

更改配置
更改redis配置

sudo vim /usr/local/redis/etc/redis.conf

#将redis改为以守护进程的方式运行

daemonize yes

取消注释requirepass

requirepass password

注释bind

#bind 127.0.0.1

添加环境变量

sudo echo 'export PATH="$PATH:/usr/local/redis/bin"'>> /etc/profile
sudo source /etc/profile

设置systemctl方式启动
添加配置启动脚本

sudo vim /etc/rc.d/init.d/redis
#!/bin/bash
#chkconfig: 2345 80 90
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.

PATH=/usr/local/bin:/sbin:/usr/bin:/bin
REDISPORT=6379
EXEC=/usr/local/redis/bin/redis-server
REDIS_CLI=/usr/local/redis/bin/redis-cli

PIDFILE=/var/run/redis.pid
CONF="/usr/local/redis/etc/redis.conf"

case "$1" in
    start)
        if [ -f $PIDFILE ]
        then
                echo "$PIDFILE exists, process is already running or crashed"
        else
                echo "Starting Redis server..."
                $EXEC $CONF
        fi
        if [ "$?"="0" ]
        then
              echo "Redis is running..."
        fi
        ;;
    stop)
        if [ ! -f $PIDFILE ]
        then
                echo "$PIDFILE does not exist, process is not running"
        else
                PID=$(cat $PIDFILE)
                echo "Stopping ..."
                $REDIS_CLI -p $REDISPORT SHUTDOWN
                while [ -x ${PIDFILE} ]
               do
                    echo "Waiting for Redis to shutdown ..."
                    sleep 1
                done
                echo "Redis stopped"
        fi
        ;;
   restart|force-reload)
        ${0} stop
        ${0} start
        ;;
  *)
    echo "Usage: /etc/init.d/redis {start|stop|restart|force-reload}" >&2
        exit 1
esac

给脚本增加运行权限

sudo chmod +x /etc/init.d/redis

查看服务列表

sudo chkconfig --list

添加服务

sudo chkconfig --add redis

配置启动级别

sudo chkconfig --level 2345 redis on

启动服务并查看

sudo systemctl start redis
sudo systemctl status redis
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值