ngbdf / redis-manager

Redis 一站式管理平台,支持集群的监控、安装、管理、告警以及基本的数据操作
Apache License 2.0
2.94k stars 714 forks source link

一键安装redis-manager #176

Open rongxr opened 1 year ago

rongxr commented 1 year ago

1、在centos7环境下测试通过 2、需要提前安装好docker和docker-compose 3、执行:sh -x install.sh

vi install.sh

mkdir -p /usr/local/redis_manager/mysql/datadir

cat > /usr/local/redis_manager/docker-compose.yml <<EOF
version: '3'

services:
  mysqldb:
    image: mysql:5.7
    container_name: mysql
    restart: always
    ports:
      - '3306:3306'
    volumes:
      - './mysql/my.cnf:/etc/mysql/my.cnf'
      - './mysql/datadir:/var/lib/mysql'
    environment:
      MYSQL_DATABASE: redis_manager
      MYSQL_ROOT_PASSWORD: 123456
    networks:
      - redis-net 

  redis-manager:
    image: reasonduan/redis-manager
    container_name: redis-manager
    restart: always
    ports:
      - '8182:8182'
    environment:
      DATASOURCE_DATABASE: redis_manager
      DATASOURCE_URL: 'jdbc:mysql://mysqldb:3306/redis_manager?useUnicode=true&characterEncoding=utf-8'
      DATASOURCE_USERNAME: root
      DATASOURCE_PASSWORD: 123456
      TZ: Asia/Shanghai
    depends_on:
      - mysqldb
    networks:
      - redis-net 

networks:
  redis-net:
    driver: bridge
EOF

cat > /usr/local/redis_manager/mysql/my.cnf <<EOF
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0

[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
lower_case_table_names=1
default-time_zone = '+8:00'

innodb_buffer_pool_size = 512M

server-id = 100
#log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 1
max_binlog_size = 500M

character-set-server = utf8mb4
collation-server = utf8mb4_general_ci

#slow_query_log_file = mysql-slow.log
slow_query_log = 1
long_query_time = 1

[client]
default-character-set=utf8mb4

[mysqldump]
quick
quote-names
max_allowed_packet = 1024M

!includedir /etc/mysql/conf.d/
EOF

cd /usr/local/redis_manager

docker-compose -f docker-compose.yml up -d