2、ceph的安装——方式二ceph-deploy

一、ceph部署

1、更新yum源

复制代码
wget -O /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo

2、下载 pip

复制代码
yum -y install python-pip

3、始终同步、关闭防火墙、selinux、三台机器做免密

复制代码
yum  install -y  ntpdate
ntpdate  ntp.aliyun.com
setenforce  0
sed  -i  '/SELINUX=/cSELINUX=disabled'    /etc/selinux/config
# 做免密---略

4、修改最大打开文件数

复制代码
cat > /etc/security/limits.conf << EOF
*  soft  nofile  65535
*  hard  nofile 65535
EOF
# 退出重新登录
ulimit -a

5、增加 ceph 的yum源

复制代码
cat > /etc/yum.repos.d/ceph.repo << EOF
[ceph]
name=ceph
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/x86_64/
gpgcheck=0
priority=1
 
[ceph-noarch]
name=cephnoarch
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/noarch/
gpgcheck=0
priority=1
 
[ceph-source]
name=Ceph source packages
baseurl=http://mirrors.aliyun.com/ceph/rpm-nautilus/el7/SRPMS
gpgcheck=0
priority=1
EOF

6、安装ceph-deploy,用于集群的初始化、用pip来安装,因为yum安装的版本太低

复制代码
pip  install  ceph-deploy==2.0.1  -i https://mirrors.aliyun.com/pypi/simple/

查看版本号

复制代码
ceph-deploy --version

7、初始化集群

先创建一个目录来执行后面的命令,因为后面会产生一些配置文件,都是在这个目录里执行才有效

复制代码
mkdir  ~/ceph-cluster
cd ~/ceph-cluster/

开始创建集群

复制代码
ceph-deploy new rabbitmq1 rabbitmq2 rabbitmq3

8、然后所有节点安装 ceph 组件包,当然了在ceph-deploy执行就可以了

复制代码
ceph-deploy  install --no-adjust-repos rabbitmq1 rabbitmq2 rabbitmq3

部署 monitor 服务,产生相关的管理秘钥

复制代码
ceph-deploy mon create-initial

查看当前目录产生的文件

复制代码
[root@server153 ceph-cluster]# ls
ceph.bootstrap-mds.keyring  ceph.client.admin.keyring
ceph.bootstrap-mgr.keyring  ceph.conf
ceph.bootstrap-osd.keyring  ceph-deploy-ceph.log
ceph.bootstrap-rgw.keyring  ceph.mon.keyring

查看启动的服务和端口

复制代码
[root@rabbitmq1 ~]# netstat -anplt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 192.168.65.129:3300     0.0.0.0:*               LISTEN      939/ceph-mon
tcp        0      0 192.168.65.129:6789     0.0.0.0:*               LISTEN      939/ceph-mon

9、将配置文件分发给所以节点

复制代码
ceph-deploy admin rabbitmq1 rabbitmq2 rabbitmq3

10、然后查看我们添加的两块磁盘

复制代码
[root@server153 ceph-cluster]# lsblk
NAME               MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda                  8:0    0   40G  0 disk 
├─sda1               8:1    0  400M  0 part /boot
└─sda2               8:2    0 39.6G  0 part 
  ├─centos-lv_root 253:0    0 37.6G  0 lvm  /
  └─centos-lv_swap 253:1    0    2G  0 lvm  [SWAP]
sdb                  8:16   0   20G  0 disk 
sdc                  8:32   0   20G  0 disk 
sr0                 11:0    1 1024M  0 rom  

注:如果刚刚添加磁盘,并且没有查到,可是试试如下命令

复制代码
$ echo "- - -" > /sys/class/scsi_host/host0/scan
$ echo "- - -" > /sys/class/scsi_host/host1/scan
$ echo "- - -" > /sys/class/scsi_host/host2/scan

11、现在将他们创建为osd对象

复制代码
$ ceph-deploy  osd create --data /dev/sdb rabbitmq1
$ ceph-deploy  osd create --data /dev/sdb rabbitmq2
$ ceph-deploy  osd create --data /dev/sdb rabbitmq3

12、然后部署 MGR 服务

复制代码
 ceph-deploy  mgr   create  rabbitmq1 rabbitmq2 rabbitmq3

13、然后查看集群情况

复制代码
ceph -s

可以看到是正常的,但是有一个警告,提示 mon允许运行在 全局 非安全环境下

所以我们现在去解决这个问题

复制代码
ceph config set  mon  auth_allow_insecure_global_id_reclaim false

二、部署dashboard

1、出现的问题

复制代码
[root@rabbitmq1 ceph-cluster]#  ceph mgr module enable dashboard
Error ENOENT: all mgr daemons do not support module 'dashboard', pass --force to force enablement

解决办法:

所有mgr节点都需要安装,不然在启用dashboard模块的时候会报错:

2、部署dashboard

dashboard作为mgr的模块存在,需要安装一下模块的软件包

复制代码
yum install ceph-mgr-dashboard -y

启用dashboard

复制代码
# ceph mgr module enable dashboard

禁用ssl加密

复制代码
# ceph config set mgr mgr/dashboard/ssl false

重启ceph-dashboard

复制代码
# ceph mgr module disable dashboard
# ceph mgr module enable dashboard

配置IP和端口

复制代码
# ceph config set mgr mgr/dashboard/server_addr  192.168.65.129
# ceph config set mgr mgr/dashboard/server_port 9009

创建dashboard用户

复制代码
[root@rabbitmq1 ceph-cluster]# ceph dashboard set-login-credentials admin 123456  ## #以前版本创建dashboard账号方式,新版本有所改变;
Invalid command: unused arguments: [u'123456']
dashboard set-login-credentials <username> :  Set the login credentials. Password read from -i <file>
Error EINVAL: invalid command
[root@rabbitmq1 ceph-cluster]# echo "123456" > pass.txt
[root@rabbitmq1 ceph-cluster]# ceph dashboard set-login-credentials admin -i pass.txt
******************************************************************
***          WARNING: this command is deprecated.              ***
*** Please use the ac-user-* related commands to manage users. ***
******************************************************************
Username and password updated

查看登录地址

复制代码
[root@rabbitmq1 ~]# ceph mgr services
{
    "dashboard": "http://rabbitmq1:9009/"
}

登录网页

复制代码
http://192.168.65.129:8080/

查看配置

复制代码
[root@rabbitmq1 ~]# ceph config dump
WHO   MASK LEVEL    OPTION                                   VALUE                                    RO
  mon      advanced auth_allow_insecure_global_id_reclaim    false
  mon      advanced mon_max_pg_per_osd                       500
  mgr      advanced mgr/dashboard//server_addr               192.168.65.129                           *
  mgr      advanced mgr/dashboard//server_port               9009                                     *
  mgr      advanced mgr/dashboard/RGW_API_ACCESS_KEY         KQK8MIE8MR3QUPHETJ0D                     *
  mgr      advanced mgr/dashboard/RGW_API_HOST               192.168.65.129                           *
  mgr      advanced mgr/dashboard/RGW_API_PORT               7480                                     *
  mgr      advanced mgr/dashboard/RGW_API_SECRET_KEY         Fa9mQbbJquSukUlaco3GxmmuUQsDHNbQH5mIUZFS *
  mgr      advanced mgr/dashboard/ceph-mgr1/server_addr      192.168.65.129                           *
  mgr      advanced mgr/dashboard/ceph-mgr1/server_port      9009                                     *
  mgr      advanced mgr/dashboard/ceph-rabbitmq1/server_addr 192.168.65.129                           *
  mgr      advanced mgr/dashboard/ceph-rabbitmq1/server_port 9009                                     *
  mgr      advanced mgr/dashboard/rabbitmq1/server_addr      192.168.65.129                           *
  mgr      advanced mgr/dashboard/rabbitmq1/server_port      9009                                     *
  mgr      advanced mgr/dashboard/ssl                        false                                    *
相关推荐
Waitccy5 小时前
CentOS 7 离线升级 OpenSSH
linux·运维·centos
黎明晓月6 小时前
Linux 上使用 Docker 部署 Kafka 集群
linux·docker·kafka
清风~徐~来6 小时前
【Linux】应用层协议 HTTP
linux·运维·http
柳如烟@6 小时前
LVS-NAT 负载均衡与共享存储配置
linux·负载均衡·lvs
Forget_85507 小时前
Linux的例行性工作
linux·运维·服务器
用手码出世界7 小时前
自定义minshell
linux·服务器
心随雪冻7 小时前
18.PCIe总线入门理解与Linux上PCIe设备配置与使用
linux·arm开发·嵌入式硬件
m0_745364248 小时前
LVS-DR模式配置脚本
linux·运维·服务器·github·lvs
不知名。。。。。。。。8 小时前
Linux--命令行操作
linux·运维·服务器
老年DBA9 小时前
Linux Namespace(网络命名空间)系列三 --- 使用 Open vSwitch 和 VLAN 标签实现网络隔离
linux·运维·服务器·网络