Redis一站式管理平臺工具,支援叢集建立,管理,監控,報警

men發表於2020-07-28

簡介

Redis Manager 是 Redis 一站式管理平臺,支援叢集的建立、管理、監控和報警。
叢集建立:包含了三種方式 Docker、Machine、Humpback;
叢集管理:支援節點擴容、縮容、Slots遷移、BeMaster、BeSlave、Memory Purge、配置修改等功能;
叢集監控:Redis 叢集重要監控指標,如Memory、Clients、命中率等;可實時檢視Redis Info、Redis Config、Slow Log等資訊;Query 功能可查詢任何型別的Key。
叢集報警:支援used_memory、clients等監控,並預設實現了郵件報警,使用者可自己對報警介面進行其他實現,如微信、簡訊報警等。

github專案地址

https://github.com/ngbdf/redis-manager

部署redis-manager

下載解壓原始碼包
# 系統環境:
# LINUX
# JDK1.8

# Releases
https://github.com/ngbdf/redis-manager/releases

#當前最新版本 1.1
wget https://github.com/ngbdf/redis-manager/releases/download/redismanager-1.1-release/redis-manager-1.1-release.tar.gz
部署java環境
rpm -ivh jdk-8u121-linux-x64.rpm 
部署mysql
init_mysql() {
rpm -e mariadb-libs --nodeps
rm -rf /var/lib/mysql
rm -rf /etc/my.cnf
tar xvf /root/mysql-5.7.23-1.el7.x86_64.rpm-bundle.tar -C /usr/local/
cd /usr/local
rpm -ivh mysql-community-server-5.7.23-1.el7.x86_64.rpm \
mysql-community-client-5.7.23-1.el7.x86_64.rpm \
mysql-community-common-5.7.23-1.el7.x86_64.rpm \
mysql-community-libs-5.7.23-1.el7.x86_64.rpm 
rm -rf mysql-community-* 
}
changepass() {
sed -i '/\[mysqld]/ a skip-grant-tables' /etc/my.cnf
systemctl restart mysqld
mysql <<EOF
        update mysql.user set authentication_string='' where user='root' and Host='localhost';
        flush privileges;
EOF
sed -i '/skip-grant/d' /etc/my.cnf
systemctl restart mysqld
yum -y install expect 

expect <<-EOF
spawn  mysqladmin -uroot -p password "ZHOUjian.20"
        expect {
                "password" { send "\r"  }
}
        expect eof
EOF
systemctl restart mysqld
}
main() {
init_mysql
changepass
}
main

create database redismanager default character set utf8mb4 collate utf8mb4_general_ci;

grant all on redismanager.* to youmen@'%' identified by 'ZHOUjian.20';
flush privileges;
部署配置redis-manager
tar xf redis-manager-1.1-release.tar.gz 
cd redis-manager-1.1/
cd conf/
vim application.yml 
server:
  tomcat.uri-encoding: UTF-8
  port: 8182

spring:
  application:
      name: redis-manager
  http:
      encoding:
        enabled: true
        force: true
        charset: UTF-8
  # 改成自己的資料庫,僅需自己建立資料庫即可,相關表會自動生成
  datasource:
      name: serverbase
      driver-class-name: com.mysql.jdbc.Driver
      url: jdbc:mysql://192.168.43.205:3306/redismanager?useUnicode=true&characterEncoding=utf-8
      username: root
      password: ZHOUjian.20
# 如果使用微信報警,填寫微信企業號相關資訊(使用者自定義擴充套件)
  wechat:

  # 如果使用郵件報警,在此處開啟開關並配置log4j郵件相關資訊
  mail:
     alarm: true
     SMTPHost: 127.0.0.1
     SMTPUsername:
     SMTPPassword:
     mailFrom: mail@newegg.com
     mailTo: mail@newegg.com
      

啟動訪問
#執行bin目錄下的start.sh指令碼
./bin/start.sh 

[root@redis-manager redis-manager-1.1]# ps -ef |grep java
root       2142      1 42 23:21 pts/2    00:00:14 java -cp conf/:lib/accessors-smart-1.1.jar:lib/activation-1.1.1.jar:lib/android-json-0.0.20131108.vaadin1.jar:lib/animal-sniffer-annotations-1.14.jar:lib/asm-5.0.3.jar:lib/aspectjrt-1.6.11.jar:lib/aspectjweaver-1.6.11.jar:lib/assertj-core-2.6.0.jar:lib/bootstrap-3.3.7.jar:lib/checker-compat-qual-2.0.0.jar:lib/classmate-1.3.3.jar:lib/commons-beanutils-1.9.3.jar:lib/commons-codec-1.10.jar:lib/commons-collections-3.2.2.jar:lib/commons-compress-1.9.jar:lib/commons-lang-2.5.jar:lib/commons-lang3-3.7.jar:lib/commons-logging-1.1.1.jar:lib/commons-pool2-2.4.2.jar:lib/error_prone_annotations-2.1.3.jar:lib/ezmorph-1.0.6.jar:lib/ganymed-ssh2-build209.jar:lib/groovy-2.4.9.jar:lib/guava-24.0-jre.jar:lib/hamcrest-core-1.3.jar:lib/hamcrest-library-1.3.jar:lib/hibernate-validator-5.3.4.Final.jar:lib/httpclient-4.4.1.jar:lib/httpcore-4.4.1.jar:lib/j2objc-annotations-1.1.jar:lib/jackson-annotations-2.8.0.jar:lib/jackson-core-2.8.7.jar:lib/jackson-databind-2.8.7.jar:lib/javassist-3.21.0-GA.jar:lib/jboss-logging-3.3.0.Final.jar:lib/jedis-2.9.0.jar:lib/jquery-3.1.0.jar:lib/jsonassert-1.4.0.jar:lib/json-lib-2.4-jdk15.jar:lib/json-path-2.2.0.jar:lib/json-smart-2.2.1.jar:lib/jsr305-1.3.9.jar:lib/junit-4.12.jar:lib/log4j-1.2.17.jar:lib/mail-1.4.jar:lib/mockito-core-1.10.19.jar:lib/mybatis-3.4.0.jar:lib/mybatis-spring-1.3.0.jar:lib/mybatis-spring-boot-autoconfigure-1.1.1.jar:lib/mybatis-spring-boot-starter-1.1.1.jar:lib/mysql-connector-java-5.1.41.jar:lib/objenesis-2.1.jar:lib/ognl-3.0.8.jar:lib/slf4j-api-1.7.24.jar:lib/slf4j-log4j12-1.7.24.jar:lib/snakeyaml-1.17.jar:lib/sockjs-client-1.0.2.jar:lib/spring-aop-4.3.7.RELEASE.jar:lib/spring-beans-4.3.7.RELEASE.jar:lib/spring-boot-1.5.2.RELEASE.jar:lib/spring-boot-autoconfigure-1.5.2.RELEASE.jar:lib/spring-boot-starter-1.5.2.RELEASE.jar:lib/spring-boot-starter-jdbc-1.5.2.RELEASE.jar:lib/spring-boot-starter-test-1.5.2.RELEASE.jar:lib/spring-boot-starter-thymeleaf-1.5.2.RELEASE.jar:lib/spring-boot-starter-tomcat-1.5.2.RELEASE.jar:lib/spring-boot-starter-web-1.5.2.RELEASE.jar:lib/spring-boot-starter-websocket-1.5.2.RELEASE.jar:lib/spring-boot-test-1.5.2.RELEASE.jar:lib/spring-boot-test-autoconfigure-1.5.2.RELEASE.jar:lib/spring-context-4.3.7.RELEASE.jar:lib/spring-core-4.3.7.RELEASE.jar:lib/spring-expression-4.3.7.RELEASE.jar:lib/spring-jdbc-4.3.7.RELEASE.jar:lib/spring-messaging-4.3.7.RELEASE.jar:lib/spring-test-4.3.7.RELEASE.jar:lib/spring-tx-4.3.7.RELEASE.jar:lib/spring-web-4.3.7.RELEASE.jar:lib/spring-webmvc-4.3.7.RELEASE.jar:lib/spring-websocket-4.3.7.RELEASE.jar:lib/stomp-websocket-2.3.3.jar:lib/thymeleaf-2.1.5.RELEASE.jar:lib/thymeleaf-layout-dialect-1.4.0.jar:lib/thymeleaf-spring4-2.1.5.RELEASE.jar:lib/tomcat-embed-core-8.5.11.jar:lib/tomcat-embed-el-8.5.11.jar:lib/tomcat-embed-websocket-8.5.11.jar:lib/tomcat-jdbc-8.5.11.jar:lib/tomcat-juli-8.5.11.jar:lib/unbescape-1.1.0.RELEASE.jar:lib/validation-api-1.1.0.Final.jar:lib/webjars-locator-0.32.jar:lib/webjars-locator-core-0.30.jar:redis-manager-1.1-SNAPSHOT.jar com.newegg.ec.cache.Application
root       2174   1936  0 23:21 pts/2    00:00:00 grep --color=auto java
      
      
      
# 驗證埠
lsof -i:8182
COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
java    2389 root  127u  IPv4  26140      0t0  TCP *:vmware-fdm (LISTEN)

Redis-Manager使用

登入

admin/admin

主介面

建立叢集

檢視監控

檢視節點詳細配置

查詢key

相關文章