Centos7部署ceph-14.2.22(nautilus)版集群(配置RGW和Prometheus监控)

一、配置RGW
1、dashboard 启用RGW ,开启Object Gateway管理功能
ceph Dashboard默认安装好后,没有启动rgw,需要手动启用RGW

#部署rgw,全部节点安装,达到高可用
yum install -y  ceph-radosgw 
ceph -s
ceph-deploy rgw create ceph1 ceph2 ceph3

2、创建rgw系统账号

查看系统当前的用户
radosgw-admin user list 
创建系统用户
radosgw-admin user create --uid=rgw --display-name=rgw --system
记下输出的access_key和secret_key的值,如果没有记住可以用以下命令查看
radosgw-admin user info --uid=rgw

3、设置access_key和secret_key

写入access_key值
echo EOTMCEYSCMIM9MAJMPBZ >access_key
写入secret_key值
echo uYhjInFIALCamU8EM5ZzeeAoobkfccEBhDQQL7az > secret_key
提供dashboard证书
ceph dashboard set-rgw-api-access-key -i access_key
ceph dashboard set-rgw-api-secret-key -i secret_key
禁用ssl
直接使用http,如果想要用https的话,不需要操作这一步
ceph dashboard set-rgw-api-ssl-verify False

二、prometheus+grafana监控ceph
1、安装grafana

#官网连接:https://grafana.com/docs/grafana/latest/installation/rpm/
cat > /etc/yum.repos.d/grafana.repo << EOF
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
EOF
#通过yum命令安装grafana
yum install grafana -y
#启动grafana并设置开机自启
systemctl enable grafana-server --now
#检查版本
grafana-server -v
grafana-cli -v

2、安装prometheus

#下载安装包,下载地址
https://prometheus.io/download/
wget https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-amd64.tar.gz
#解压
tar -zxvf prometheus-2.29.2.linux-amd64.tar.gz
#移动到安装目录
mv prometheus-2.29.2.linux-amd64 /usr/local/prometheus
#查看版本
cd /usr/local/prometheus/
./prometheus --version
#配置系统服务启动
cat > /etc/systemd/system/prometheus.service << EOF
[Unit]
Description=Prometheus Monitoring System
Documentation=Prometheus Monitoring System
 
[Service]
ExecStart=/usr/local/prometheus/prometheus \\
  --storage.tsdb.path=/usr/local/prometheus/data \\
  --config.file=/usr/local/prometheus/prometheus.yml \\
  --web.listen-address=:9090
 
[Install]
WantedBy=multi-user.target
EOF
#重新加载系统服务
systemctl daemon-reload
#启动服务和添加开机自启
systemctl enable prometheus --now
systemctl status prometheus

3、ceph mgr prometheus插件配置

ceph mgr module enable prometheus
ceph mgr module ls|head -20
#检查服务
ceph -s |grep mgr
netstat -nutlp|grep mgr
curl 192.168.112.130:9283/metrics

4、配置prometheus

在scrape_configs:配置项下添加
cat >> /usr/local/prometheus/prometheus.yml << EOF
  - job_name: "prometheus"
    static_configs:
      - targets: ["192.168.112.130:9283"]
EOF
注意:192.168.112.130这个是正在运行mgr得IP
ceph -s|grep mgr
#重启prometheus服务
systemctl restart prometheus
systemctl status prometheus
#检查prometheus服务器中是否添加成功
浏览器-》http:192.168.112.130:9090-》status-》Targets

prometheus界面

5、配置grafana

URL:http:192.168.112.130:3000
默认登录的用户名密码都是admin,登录成功后会强制修改密码admin123
https://grafana.com/grafana/dashboards?search=ceph 常用于的ceph监控的模板,这里我选的是:917、2842

1、官网选择监控模板
grafana选监控模板
grafana选监控模板1
2、添加数据源
grafana添加数据源
3、添加数据源之后,选择prometheus
grafana添加数据源选择pro
4、填写prometheus监控的url
grafana添加数据源url
5、导入监控数据
grafana点击导入
6、这里填写我们刚在官网找到的,用的最多的模板id:2842
grafana点击导入2842
7、导入成功
grafana点击导入成功

© 版权声明
THE END
喜欢就支持一下吧
点赞0 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容