安装redis-stat
2021-06-29 本文已影响0人
小KKKKKKKK
1.安装原因
由于使用redis资源池像更好的优化redis资源池的配置,并且更好的监控redis,安装一个redis-stat。
2.安装步骤
2.1.安装ruby
yum -y install ruby
2.2.安装redis-stat
gem install redis-stat
2.3.启动redis-stat
通过redis-stat --help可以看到使用指南
redis-stat --help
usage: redis-stat [HOST[:PORT] ...] [INTERVAL [COUNT]]
-a, --auth=PASSWORD Password
-v, --verbose Show more info
--style=STYLE Output style: unicode|ascii
--no-color Suppress ANSI color codes
--csv[=CSV_FILE] Print or save the result in CSV
--es=ELASTICSEARCH_URL Send results to ElasticSearch: [http://]HOST[:PORT][/INDEX]
--server[=PORT] Launch redis-stat web server (default port: 63790)
--daemon Daemonize redis-stat. Must be used with --server option.
--version Show version
--help Show this message
2.4.启动web
redis-stat localhost:6379 --daemon --server=63790 5
image.png
安装完成
2.5.遇到的问题-安装redis-stat时提示requires Ruby version >= 2.3.0
查询资料时发现Centos默认支持ruby到2.0.0,通过gem安装redis需要2.3.0
解决办法:先安装rvm,再把ruby版本提升到2.3.0
1.安装rvm
curl -L get.rvm.io | bash -s stable
但是发现报错
<em id="__mceDel">Downloading https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc
gpg: Signature made Wed 08 May 2019 10:14:49 PM CST using RSA key ID 39499BDB
gpg: Can't check signature: No public key
GPG signature verification failed for '/usr/local/rvm/archives/rvm-1.29.8.tgz' - 'https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc'! Try to install GPG v2 and then fetch the public key:
gpg2 --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
or if it fails:
command curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
command curl -sSL https://rvm.io/pkuczynski.asc | gpg2 --import -<br>
</em>
根据提示进行安装
curl -sSL https://rvm.io/mpapis.asc | gpg2 --import -
gpg: keyring `/root/.gnupg/secring.gpg' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
gpg: no ultimately trusted keys found
curl -L get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 194 100 194 0 0 277 0 --:--:-- --:--:-- --:--:-- 277
100 24168 100 24168 0 0 6932 0 0:00:03 0:00:03 --:--:-- 16690
Downloading https://github.com/rvm/rvm/archive/1.29.8.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.8/1.29.8.tar.gz.asc
gpg: Signature made Wed 08 May 2019 10:14:49 PM CST using RSA key ID 39499BDB
gpg: Good signature from "Piotr Kuczynski <piotr.kuczynski@gmail.com>"
gpg: WARNING: This key is not certified with a trusted signature!
gpg: There is no indication that the signature belongs to the owner.
Primary key fingerprint: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
GPG verified '/usr/local/rvm/archives/rvm-1.29.8.tgz'
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
* Please do NOT forget to add your users to the rvm group.
The installer no longer auto-adds root or users to the rvm group. Admins must do this.
Also, please note that group memberships are ONLY evaluated at login time.
This means that users must log out then back in before group membership takes effect!
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
find / -name rvm.sh
返回
/etc/profile.d/rvm.sh
rvm requirements
rvmsudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
2.生成rvm环境
source /usr/local/rvm/scripts/rvm
3.查看rvm库中已知的ruby版本
rvm list known
4.安装相应版本的ruby
rvm install 2.3.0
5.使用一个ruby版本
rvm use 2.3.0
下来再安装redis-stat