centos7.9安装ceph,客户端挂载访问

  • 修改hosts文件
  • 免密配置
  • 配置yum源,创建部署目录
  • 安装ceph
  • 配置访问Ceph Manager Dashboard

一、修改hosts文件

[root@host1 yum.repos.d]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.159.128 host1 host1.localdomain
192.168.159.129 host2 host2.localdomain
192.168.159.130 test test.localdomain

192.168.26.130 test
192.168.26.129 host2
192.168.26.128 host1  #每个主机都修改一下

二、免密配置

ssh-keygen -t rsa   #-t 加密算法类型,生成两个文件:id_rsa、id_rsa.pub
ssh-copy-id root@host1
ssh-copy-id root@host2
ssh-copy-id root@test  #ssh-copy-id 会自动把生成的id_rsa_pub内容>>添加到.ssh/authorized_keys

三、配置yum源,创建部署目录

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
#阿里云:mirrors.aliyun.com
#配ceph源:
# cd /etc/yum.repos.d/
# vim ceph.repo
[noarch]
name=noarch
baseurl=https://mirrors.aliyun.com/ceph/rpm-nautilus/el7/noarch/
enabled=1
gpgcheck=0

[x86_64]
name=x86 64
baseurl=https://mirrors.aliyun.com/ceph/rpm-nautilus/el7/x86_64/
enabled=1
gpgcheck=0

#创建部署目录,只在mon节点创建
mkdir /root/ceph && cd /root/ceph

四、安装ceph

#每个机器都执行,安装部署工具:
yum -y install python-setuptools ceph-deploy
#每个机器都执行,安装ceph-mds和ceph
yum install -y ceph ceph-mds
#每个机器都执行,创建/etc/ceph目录
mkdir /etc/ceph
#mon节点安装ceph
yum install -y ceph ceph-mon ceph-mgr ceph-radosgw 
#创建ceph集群
ceph-deploy new test --cluster-network 192.168.26.0/24 --public-network 192.168.159.0/24
# monitor初始化:
ceph-deploy mon create-initial
# monitor初始化:在test节点上创建Ceph monitor,并查看mon状态
ceph-deploy mon create test
ceph-deploy gatherkeys test
ceph mon stat

# 推送配置文件到节点:
ceph-deploy admin host1 host2
ceph-deploy --overwrite-conf admin host1 host2 #多次推送
# 创建manager daemon来做监控:
ceph-deploy mgr create test
#创建osd
ceph-deploy osd create test --data /dev/sdb
ceph-deploy osd create host1 --data /dev/sdb
ceph-deploy osd create host2 --data /dev/sdb
#ceph创建mds,部署mds服务
ceph-deploy mds create  host1 host2
ceph mds stat
ceph fs ls
ceph osd lspools

ceph osd pool create cephfs_metadata 64
ceph osd pool create cephfs_data 64
ceph fs new fs_test cephfs_metadata cephfs_data
ceph fs ls
ceph mds stat

#屏蔽告警后查看
ceph config set mon auth_allow_insecure_global_id_reclaim false
ceph config set global mon_warn_on_pool_no_redundancy false

五、配置访问Ceph Manager Dashboard

#1、安装ceph-mgr-dashboard组件
yum -y install ceph-mgr-dashboard jq
#2、启用dashboard功能
ceph mgr module ls | jq .enabled_modules
ceph mgr module enable dashboard
结果如下:
[root@test ~]# ceph mgr module ls | jq .enabled_modules
[
  "dashboard",
  "iostat",
  "restful"
]
#3、修改mgr的默认配置
ceph config set mgr mgr/dashboard/ssl false #不适用ssl
ceph config set mgr mgr/dashboard/server_addr 192.168.159.130 #配置dashboard监听地址
ceph config set mgr mgr/dashboard/server_port 1025 #配置dashboard的监听端口,默认是8080端口,修改端口不要小于1024,对于普通用户ceph没有权限监听小于1024的端口哟~
#4、创建dashboard用于登录的用户认证信息
echo yinzhengjie > password.txt
ceph dashboard ac-user-create admin -i password.txt  administrator #创建administrator权限的admin用户,密码指向一个文件password.txt
#5、重启mgr生效
ceph mgr services
systemctl restart ceph-mgr@test.server
[root@test ~]# ceph mgr services
{
    "dashboard": "http://test.localdomain:1025/"
}
[root@test ~]#

测试访问:192.168.159.130:1025

点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注