六、部署mds
在每个ceph节点上执行以下操作
- 创建mds工作目录
mkdir -p /var/lib/ceph/mds/ceph-0
- 注册MDS的密钥
ceph auth get-or-create mds.0 mon 'allow rwx' osd 'allow *' mds 'allow' -o /var/lib/ceph/mds/ceph-0/keyring
上面mds的权限不能写成allow *,要不然会报错。
- 启动mds进程并设置系统自动启动
touch /var/lib/ceph/mds/ceph-0/sysvinit
service ceph start mds.node0
systemctl start ceph-mds@0
apt-get install ceph-mds
ceph-mds --cluster ceph -i 0 -m 10.111.131.125:6789 -f
# -f 显示是日志
4、创建文件系统
ceph osd pool create cephfs_data 100
ceph osd pool create cephfs_metadata 100
ceph fs new cephfs cephfs_metadata cephfs_data
查看ceph集群
ceph fs ls #查看创建后的cephfs
mds 三种状态
**Up** - 等级up一旦被分配给守护进程。
**Failed** - 等级failed是否与MDS守护程序的实例无关。
**Damaged** - 当元数据损坏或丢失时,排名会被损坏。在您修复问题并ceph mds repaired在损坏的等级上使用命令之前,不会将损坏的等级分配给任何MDS守护程序。
######################################
In the below instructions, {id} is an arbitrary name, such as the hostname of the machine.
Create the mds data directory.:
mkdir -p /var/lib/ceph/mds/{cluster-name}-{id}
Create a keyring.:
ceph-authtool --create-keyring /var/lib/ceph/mds/{cluster-name}-{id}/keyring --gen-key -n mds.{id}
Import the keyring and set caps.:
ceph auth add mds.{id} osd "allow rwx" mds "allow" mon "allow profile mds" -i /var/lib/ceph/mds/{cluster}-{id}/keyring
Add to ceph.conf.:
[mds.{id}]
host = {id}
Start the daemon the manual way.:
ceph-mds --cluster {cluster-name} -i {id} -m {mon-hostname}:{mon-port} [-f]
Start the daemon the right way (using ceph.conf entry).:
service ceph start
If starting the daemon fails with this error:
mds.-1.0 ERROR: failed to authenticate: (22) Invalid argument
Then make sure you do not have a keyring set in ceph.conf in the global section; move it to the client section; or add a keyring setting specific to this mds daemon. And verify that you see the same key in the mds data directory and ceph auth get mds.{id} output.
Now you are ready to create a Ceph filesystem.
网友评论