Universal redis-cli terminal operation and management shortcut script Version 1.1.0
(Script Last updated: 2016-10-21)
File Name: quick-redis-cli.sh
Copyright: 2016 Jack Liu (Liu Jianqiu Qiu)
License: MIT
Version: Version 1.1.0
Author: Jack Liu (Liu Jianqiu 秋)
Email: ceophp@163.com
QQ: 1099729311 404691073(work used)
Created Init By Date: 2016-03-18
[write reason]
In practice, redis-cli is used to manage redis instances almost every day. Some repetitive operations are performed using shell script processes. Before that, a redis-cli quick connect script was written, which saves a lot of unnecessary time. The late idle time expands some of the functions. The script is very simple. There will be time to add more useful functions and batch redis instance functions for multi-instance management. A small number of servers are temporarily implemented with a shell to meet general operating requirements.
Subsequent extraction time is compiled into binary execution using Golang, and the execution efficiency is high.
Script 1.1.0 to achieve basic functions, follow-up time update will focus on the specific scene business batch
Redis-cli operations often have to repeatedly hit the command, in many business scenarios, the general redis GUI graphical interface management tools can not handle a few pain points:
- Regardless of the local or remote IP management, the password must be input repeatedly for password-containing operations. In addition, the high-intensity password is complex to set up safely, manual input is inefficient, and paste operations must be repeated.
- In the production isolation environment on the line, the visualization GUI management software also has to be inconvenient and insecure through proxy management. Many operation and maintenance scenarios are not applicable and occupy the link resources.
- In the CLI mode, the internal isolated redis instance server is frequently managed by the bastion machine (board springboard). The IP and password verification input repeats many operations and is error-prone. (The subsequent script update implements management of n instances and batch management.) ...
[main use]
Fast use of redis-cli terminal connection and switching in different operation and maintenance scenarios
[Disclaimer]
If you are unfamiliar with the script, do not operate directly on the production server. After the test environment is confirmed to be correct, use it again!
The script is not confused with the code. It can be freely expanded according to its own business scenario.
【Main Function Points】
【Directory Structure】
etc configuration directory:
etc/README Help Documentation
etc/server_list.conf Management Instance Configuration
[version 1.1.0 script help description (Best Update Date: 2016-10-21)]
Document Latest Update Date: 2016-11-01
[script parameters]
-v : View the current version of the script.
-help : Check the help documentation.
-list : Views the list of manageable instances and operates on the specified redis instance according to the number.
-c [Number] : An instance of a quick selection operation based on the number.
[main use]
Easy to use redis-cli terminal to manage redis instances in different operation and maintenance scenarios.
[Disclaimer]
If you are unfamiliar with the script, do not operate directly on the production server. After the test environment is confirmed to be correct, use it again!
The script is not confused with the code. It can be freely expanded according to its own business scenario.
[function description]
(1) Satisfy quick login command
(2) Connection Mode Selection:
Local mode:
(HOST:127.0.0.1)
Remote mode:
Manually set the specified IP and port number
(3) Basic check of configuration items:
Local mode: The default basic redis configuration item provides some common security configuration checks (only basic configuration item checks are provided)
Remote mode: check the port number configuration, do not provide cross-server (take into account the generality, security and other factors, temporarily upload this part of the function, there is a need to contact myself)
Validation mode: 0 Loose mode (only prompt or warning, process continues to execute); 1 Strict mode (error or warning to terminate the operation)
[Next version plan]
(1). Script Status Processing
(2). Distributed redis instance management basics:
(3).Log module:
Increase the basic operation and maintenance script operation log log and error log tracking
(4).redis instance status indicator monitoring
【Remarks】:
(1).Local configuration item processing: redis.conf:
The requirepass password is automatically fetched into the shell analysis to check if the password entry has been set to avoid manually setting a new password after the modification.
(2).Do not provide automatic remote server password capture (mainly for permissions and security considerations), only provide some ideas
The
Link: email:ceophp@163.com qq:404691073 (working frequently) 1099729311
End!
(Usually busy work, will spare time to update, email or qq exchange at any time)