微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

CEPH Jewel+Ubuntu14.04+Calamari部署之CEPH Jewel集群部署

CEPH简介

是一种已经震撼了整个存储行业的最热门的软件定义存储技术(Softwaredefined Storage,SDS)。它是要给开源项目,为块存储、文件存储和对象存储提供了统一的软件定义解决方案。CEPH旨在提供一个扩展性强大、性能优越且无单点故障的分布式存储系统。从一开始,CEPH就被设计为能在通用商业硬件上运行,并且支持高度扩展(逼近甚至超过艾字节的数量)。

《Ceph Cookbook》

一、环境准备

1.Vmware安装Ubuntu14.04共3台(分别是node1、node2、node3)。同时安装openssh-server服务。

node1作为monitor节点。node2和node3作为osd设备,并挂载适当大小的硬盘。

2.启用两张网卡,eth0设置为仅主机模式(在虚拟机中仅主机网络不受外网干扰,集群健壮性更好),eth1设置为桥接模式。仅主机网络需设置静态IP,桥接网络随意。

root@node1:~# vim /etc/network/interfaces

auto eth1

iface eth1 inet static

address 10.10.11.101

netmask 255.255.0.0

gateway 10.10.1.1

dns-nameservers 10.10.1.1 8.8.8.8

auto eth0

iface eth0 inet static

address 192.168.107.21

3.分别修改这三台设备的源,将apt的源文件替换成阿里云源,因为国内的源下载速度比较快。

root@ node1:~# cat /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ trusty main restricteduniverse multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-security mainrestricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-updates mainrestricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed mainrestricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ trusty-backports mainrestricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricteduniverse multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security mainrestricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates mainrestricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed mainrestricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports mainrestricted universe multiverse

root@ node1:~# apt_get update

root@ node1:~#

二、开始部署(建议直接用root用户,以下以root用户为例)

1修改每个节点的主机名分别为node1node2 node3 (hostnamectl set-hostname $HOSTNAME)修改每台机器的host文件 (做一个硬解析),修改后可以通过名字访问各个设备。

root@node1:~/ceph-cluster# cat /etc/hosts

127.0.0.1 localhost

127.0.1.1 ubuntu14

# The following lines are desirable for IPv6 capable hosts

::1localhost ip6-localhost ip6-loopback

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

192.168.107.21 node1

192.168.107.22 node2

192.168.107.23 node3

2. 安装ceph-deploy(只在管理节点上执行)

wget -q -O-'https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/release.asc' | sudoapt-key add -
echo deb http://mirrors.163.com/ceph/debian-jewel$(lsb_release -sc) main |tee/etc/apt/sources.list.d/ ceph.list
apt-get update
apt-get install ceph-deploy

4、 用无密码的SSH连接到每个Ceph节点来配置你的ceph-deploy 管理节点. 保留密码为空。

创建密钥,提示输入的时候一直回车键即可。

ssh-keygen

将密钥拷贝到其他osd设备上去。

ssh-copy-idroot@node1

ssh-copy-idroot@node2

ssh-copy-idroot@node3

测试:此时您可以直接用ssh node2直接登陆到node2主机,不需要输入密码。

5修改你的ceph-deploy管理节点的~/.ssh/config 文件使它能像你创建的用户(比如一样记录至节点 .可能不存在 这个配置文件,但是你可以创建一个这样的配置文件配置文件中的内容如下:

root@ node1:~/ceph-cluster# cat ~/.ssh/config

Host node1

User root

Host node2

Host node3

User root

6、创建一个自己的集群目录(目录名随意)

mkdir ceph-cluster

cd ceph-cluster

7、创建一个新的集群

ceph-deploy new node1

8修改ceph.conf配置文件 vim ceph.conf

osd pool default size = 3 ---》设置副本个数,不建议超过osd数量

osd pool default min size = 1 --->设置可写最小副本个数

osd pool default pg num = 333 ---》设置pool的pg个数

osd pool default pgp num = 333--》设置pool的pgp_num个数

9、分别在所有的设备上安装ceph

ceph-deploy install node1 node2 node3

注意:安装的时候很有可能出现各种不同的、不知名错误,如果解决不了也可以用以下方式在各节点单独安装,安装完成后可:

http://mirrors.163.com/ceph/debian-jewel$(lsb_release -sc) main | tee /etc/apt/sources.list.d/ceph.list
apt-get update
apt-get install ceph

10、在上创建监视线程,并且初始化:

ceph-deploy mon create-initial

11修改密钥文件权限:

chmod 777 ceph.client.admin.keyring

chmod 777 /etc/ceph/ceph.client.admin.keyring

12、列出各主机上面可以用的磁盘:

ceph-deploy disk list node1 node2 node3

13、格式化上的盘为xfs,并创建线程。

ceph-deploy disk zapnode2:/dev/sdb

ceph-deploy osd create node2:/dev/sdb

ceph-deploy disk zap node3:/dev/sdb

ceph-deploy osd create node3:/dev/sdb

14、拷贝配置文件到每一台机器上

ceph-deploy admin node1 node2 node3

chmod+r /etc/ceph/ceph.client.admin.keyring

15. 查看ceph的安装状态,如果集群健康则完成部署,若集群不健康则根据具体问题修改相关参数即可health ok

ceph�Cs

16.一切正常则在此拍摄快照

原文地址:https://www.jb51.cc/ubuntu/355585.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐