首页
✨运维
🎉安装
👀踩坑
🤷‍♂️学习
😊关于
  • 分类
  • 标签
  • 归档
GitHub

Summer

运维界的小白
首页
✨运维
🎉安装
👀踩坑
🤷‍♂️学习
😊关于
  • 分类
  • 标签
  • 归档
GitHub
  • Docker

  • Zabbix

  • Elasticsearch

  • K8s

  • Mysql

  • Redis

    • redis5安装说明
      • 离线安装redis5.0.8
      • 用法说明
      • 启动脚本
  • Nginx

  • Prometheus

  • 安装
  • Redis
summer
2020-11-04

redis5安装说明

# 离线安装redis5.0.8

安装包含脚本链接 (提取码:1314)

# 用法说明

  1. 解压命令:unzip redis.zip -d /home/summer &>/dev/null

  2. cd /home/summer/redis-5.0.8/utils/create-cluster

  3. 执行启动命令:./create-cluster start

  4. 停止命令:./create-cluster stop

  5. 清理命令(重启时用):./create-cluster clean

  6. 默认密码:summerking

  7. 默认启动27000和27001两个端口

# 启动脚本

#!/bin/bash

# Settings
PORT=26999
TIMEOUT=2000
NODES=2
REPLICAS=1
reids_pwd=summerking
ip=$(ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk '{print $2}'|tr -d "addr:")

# Computed vars
ENDPORT=$((PORT+NODES))

if [ "$1" == "start" ]
then
    while [ $((PORT < ENDPORT)) != "0" ]; do
        PORT=$((PORT+1))
        echo "Starting $PORT"
        /home/summer/redis-5.0.8/src/redis-server --port $PORT --bind $ip --masterauth $reids_pwd --requirepass $reids_pwd --protected-mode no --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes
    done

    exit 0
fi

if [ "$1" == "stop" ]
then
    while [ $((PORT < ENDPORT)) != "0" ]; do
        PORT=$((PORT+1))
        echo "Stopping $PORT"
        /home/summer/redis-5.0.8/src/redis-cli -a $reids_pwd -h $ip -p $PORT shutdown nosave
    done
    kill -9 $(ps -ef | grep redis | grep -v grep | awk '{print $2}')
    exit 0
fi

if [ "$1" == "clean" ]
then
    cd /home/summer/redis-5.0.8/utils/create-cluster
    rm -rf *.log
    rm -rf appendonly*.aof 
    rm -rf dump*.rdb
    rm -rf nodes*.conf
    exit 0
fi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
mysql主从搭建
编译安装nginx

← mysql主从搭建 编译安装nginx→

最近更新
01
redis持久化
12-08
02
redis为什么这么快
12-08
03
redis的优缺点
12-08
更多文章>
Theme by Vdoing | Copyright © 2019-2020 Evan Xu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式