Summary of Ceph practice: CephFS client configuration, cephcephfs
Because CephFS is not very stable at present, it may be used in more experiments.
Before proceeding to this chapter, you need to complete the basic cluster building, please refer to the http://blog.csdn.net/eric_sunah/article/details/40862215
You can attach a file system to a VM or on an independent physical machine. do not perform the following operations on the machine in the ceph cluster.
Prepare for renewal ¶
Use OS Recommendations to determine whether your client OS meets the basic requirements.
Use on Management Nodesceph-deploy
Inceph-client
If ceph is installed on the node, it is called cephclient.
ceph-deploy install cephclient
Use on Management Nodesceph-deploy
Copy the ceph configuration file andceph.client.admin.keyring
ToOn cephclient
ceph-deploy admin cephclient
ceph-deploy
Will copy the keyring file/Etc/ceph directory
. To ensure security, you can set the appropriate permissions for the file (e.g .,sudo chmod +r /etc/ceph/ceph.client.admin.keyring
).
Ensure that the Ceph storage cluster is in good running status, and pg is in active + clean status. Make sure that at least one mds service is running.
Create a File System
For a newly created MDS service, although the service is running, its status will not change to Active until the pools and file system are created.
Status at creation time
Ceph cluster status
Create a Filesystem using the following operations
ceph osd pool create cephfs_data 10ceph osd pool create cephfs_metadata 10ceph fs new leadorfs cephfs_metadata cephfs_data
After successful creation, the state of the mds stat is as follows:
The ceph cluster status, pg quantity, and pool quantity are increased accordingly.
Create a Secret file
By default, a Ceph cluster requires permission verification. To create a key file containing individual users, perform the following steps:
Find the key:
cat ceph.client.admin.keyring
Copy the user's key used to mount the file system:
[client.admin] key = AQCj2YpRiAe6CxAA7/ETt7Hcl9IyxyYciVs47w==.
Create an empty file and copy the key content:
AQCj2YpRiAe6CxAA7/ETt7Hcl9IyxyYciVs47w==
Use the user's name to save the file (e.g .,Admin. secret).
Set file permissions.
Mount a volume in the form of a Kernel Driver ¶
Mount the file by using the following methods.
sudo mkdir /mnt/mycephfssudo mount -t ceph 192.168.40.107:6789:/ /mnt/mycephfs
Because the ceph cluster performs permission verification by default, you may need to specify the user name and secrte file name when performing this operation:
sudo mount -t ceph 192.168.40.107:6789:/ /mnt/mycephfs -o name=admin,secretfile=admin.secret
Mount a volume in the form of User Space (FUSE ¶Install ceph-fuse yum install-y ceph-fuse
sudo mkdir ~/mycephfssudo ceph-fuse -m 192.168.40.107:6789 ~/mycephfs
Call method of the specified key file
sudo ceph-fuse -k ./ceph.client.admin.keyring -m 192.168.40.107:6789 ~/mycephfs
View the result after mounting. Observe the type
UnmountTo unmount a disk, follow these steps:
sudo umount /mnt/mycephfs