Ceph文件系统
1)disable iptables&selinux
1 |
|
- set hostname as ceph
1
2
3
4HOSTNAME=ceph
hostnamectl set-hostname ceph
IP=`ip route |grep src|grep metric|awk -F" " '{ print $9 }'`
echo "$IP $HOSTNAME" >>/etc/hosts - install epel.repo4)update system & install ceph-deploy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29yum install -y epel-release
cat <<EOF > /etc/yum.repos.d/ceph.repo
[Ceph]
name=Ceph packages for $basearch
baseurl=http://mirrors.163.com/ceph/rpm-jewel/el7/x86_64
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.163.com/ceph/keys/release.asc
priority=1
[Ceph-noarch]
name=Ceph noarch packages
baseurl=http://mirrors.163.com/ceph/rpm-jewel/el7/noarch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.163.com/ceph/keys/release.asc
priority=1
[ceph-source]
name=Ceph source packages
baseurl=http://mirrors.163.com/ceph/rpm-jewel/el7/SRPMS
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=http://mirrors.163.com/ceph/keys/release.asc
priority=1
EOF1
yum update -y &&yum clean all &&yum -y install ceph-deploy
- 设置本机密匙6)ceph服务初始化
1
2ssh-keygen -t rsa -P "" -f ~/.ssh/id_rsa
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys7)修改配置文件1
2
3yum clean all &&yum -y install ceph-deploy
mkdir /etc/ceph &&cd /etc/ceph
ceph-deploy new ceph8)安装ceph1
2
3cp ceph.conf ceph.conf.bak
sed -i 's@^$@osd_pool_default_size = 1@g' ceph.conf
echo "mon_pg_warn_max_per_osd = 1000" >> /etc/ceph/ceph.conf9)创建monitor服务1
ceph-deploy install ceph
1
2ceph-deploy mon create ceph
ceph-deploy gatherkeys ceph - 准备osd11)修改配置文件权限
1
2
3
4
5
6
7
8
9mkfs.xfs /dev/sdb
mkdir -p /var/local/osd
mount /dev/sdb /var/local/osd/
chown -R ceph:ceph /var/local/osd* #创建osd
ceph-deploy osd prepare ceph:/var/local/osd #激活osd
ceph-deploy osd activate ceph:/var/local/osd
chown -R ceph:ceph /var/local/osd* #有些同学可能会忘记配置目录权限引起激活osd失败
#查看状态:###
ceph-deploy osd list ceph12)部署mds服务1
2ceph-deploy admin ceph
chmod +r /etc/ceph/*13)创建ceph文件系统1
2ceph-deploy mds create ceph
ceph mds stat14)挂载Ceph文件系统1
2
3
4
5ceph fs ls
ceph osd pool create cephfs_data 128
ceph osd pool create cephfs_metadata 128
ceph fs new cephfs cephfs_metadata cephfs_data
ceph fs ls15)查看ceph状态1
2
3
4
5
6mkdir /ceph
yum install -y ceph-fuse
IP=`ip route |grep src|grep metric|awk -F" " '{ print $9 }'`
ceph-fuse -m $IP:7480/ /ceph
#ceph-fuse -m $IP:6789/ /ceph
df -Th1
2
3
4
5ceph mon stat
ceph osd stat
ceph osd tree #显示crush图
ceph pg stat
set password for root@localhost = password('S@Aj#XrpS114y!9$'); #设置mysql密码
##部署ceph对象存储-bucket
1)安装ceph-radosgw
1 |
|
2)部署rgw
1 |
|
3)如果要修改为80端口,可修改配置文件 重启
1 |
|
4)创建池
1 |
|
5)测试是否能访问ceph集群
1 |
|
6)使用S3 API访问ceph对象存储
创建radosgw用户
1 |
|
7)安装s3cmd客户端
1 |
|
8)使用Swift API访问ceph对象存储
1 |
|
9)最后验证
1 |
|
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.