We perform the following operations on the admin node to configure the file system using the ceph cluster
Prerequisites
1. Install ceph on the ceph-client node
ceph-deploy install ceph-client
2. Confirm that the ceph cluster is in the active+clean state, and confirm that at least one metadata server is running
ceph -s [-m {monitor-ip-address}] [-k {path/to/ceph.client.admin.keyring}]
#配置好ceph.conf 和 keyring文件之后,直接ceph -s即可
Create a file system
The MDS you have created is not active unless you have created some pools and filesystems
ceph osd pool create cephfs_data <pg_num>
ceph osd pool create cephfs_metadata <pg_num>
ceph fs new <fs_new> cephfs_metadata cephfs_data
Create secret file
The ceph cluster has authentication enabled by default, and you should have a file (not keyring) that holds the key.
Perform the following steps to obtain the secret key of the specified user
1. Identify the user's key in the keyring file
cat ceph.client.admin.keyring
2. Copy the key of the user used to mount the ceph file system, for example:
[client.admin]
key = AQCj2YpRiAe6CxAA7/ETt7Hcl9IyxyYciVs47w==
3. Create a file and write the key to it
AQCj2YpRiAe6CxAA7/ETt7Hcl9IyxyYciVs47w==
4. Save the file name as username (for example: admin.secret)
5. Make sure the user has permissions and is not visible to other users
Use: kernel driver
Mount ceph FS as a kernel driver
mkdir /mnt/mycephfs
mount -t ceph {ip-address-of-monitor}:6789:/ /mnt/mycephfs
The ceph cluster uses the authentication service by default, specifying the username and user secretfile
mount -t ceph 192.168.0.1:6789:/ /mnt/mycephfs -o name=admin,secretfile=admin.secret
Note that the Ceph FS filesystem is mounted on the master node, not the server node.
Use: Userspace filesystem (fuse)
Mount ceph FS as a file system in user space
mkdir ~/mycephfs
ceph-fuse -m {ip-address-of-monitor}:6789 ~/mycephfs
Ceph storage clusters use authentication by default. Specify the keyring if it is not in the default location (i.e. /etc/ceph)
ceph-fuse -k ./ceph/client.admin.keyring -m 192.168.0.1:6789 ~/mycephfs
extra information
See Ceph FS for more information.
Ceph FS is not as stable as Ceph Block Device and Ceph Object Storage.