说明:源码安装可以了解到系统各个组件, 但是安装过程也是很费劲的,主要是依赖包太多。 当时尝试了centos 和 ubuntu 上安装,都是可以安装好的。
4、
先安装依赖包
#apt-get install autotools-dev autoconf automake cdbs g++ gcc git libatomic-ops-dev libboost-dev \
libcrypto++-dev libcrypto++ libedit-dev libexpat1-dev libfcgi-dev libfuse-dev \
libgoogle-perftools-dev libgtkmm-2.4-dev libtool pkg-config uuid-dev libkeyutils-dev \
uuid-dev libkeyutils-dev btrfs-tools
4 可能遇到错误
4.1 fuse:
apt-get install fuse-devel
4.2 tcmalloc:
wget
安装google-perftools
4.3 libedit:
apt-get install libedit-devel
4.4 no libatomic-ops found
apt-get install
libatomic_ops-devel
4.5 snappy:
4.6 libleveldb not found:
make
cp libleveldb.* /usr/lib
cp -r include/leveldb /usr/local/include
4.7 libaio
apt-get install libaio-dev
4.8 boost
apt-get install libboost-dev
apt-get install libboost-thread-dev
apt-get install libboost-program-options-dev
4.9 g++
apt-get install g++
5 编译安装
[global]
# For version 0.55 and beyond, you must explicitly enable
# or disable authentication with "auth" entries in [global].
auth cluster required = none
auth service required = none
auth client required = none
[osd]
osd journal size = 1000
#The following assumes ext4 filesystem.
filestore xattr use omap = true
# For Bobtail (v 0.56) and subsequent versions, you may
# add settings for mkcephfs so that it will create and mount
# the file system on a particular OSD for you. Remove the comment `#`
# character for the following settings and replace the values
# in braces with appropriate values, or leave the following settings
# commented out to accept the default values. You must specify the
# --mkfs option with mkcephfs in order for the deployment script to
# utilize the following settings, and you must define the 'devs'
# option for each osd instance; see below.
osd mkfs type = xfs
osd mkfs options xfs = -f # default for xfs is "-f"
osd mount options xfs = rw,noatime # default mount option is "rw,noatime"
# For example, for ext4, the mount option might look like this:
#osd mkfs options ext4 = user_xattr,rw,noatime
# Execute $ hostname to retrieve the name of your host,
# and replace {hostname} with the name of your host.
# For the monitor, replace {ip-address} with the IP
# address of your host.
[mon.a]
host = ceph1
mon addr = 192.168.1.1:6789
[osd.0]
host = ceph1
# For Bobtail (v 0.56) and subsequent versions, you may
# add settings for mkcephfs so that it will create and mount
# the file system on a particular OSD for you. Remove the comment `#`
# character for the following setting for each OSD and specify
# a path to the device if you use mkcephfs with the --mkfs option.
devs = /dev/sdb1
[mds.a]
host = ceph1
5、执行初始化
sudo
mkcephfs -a -c /etc/ceph/ceph.conf -k /etc/ceph/ceph.keyring
注意每次初始化 需要 删除原有 数据 目录
rm
–rf /var/lib/ceph/osd/ceph-0/*
rm
–rf /var/lib/ceph/osd/ceph-1/*
rm
–rf /var/lib/ceph/mon/ceph-a/*
rm –rf /var/lib/ceph/mds/ceph-a/*
mkdir
-p /var/lib/ceph/osd/ceph-0
mkdir
-p /var/lib/ceph/osd/ceph-1
mkdir
-p /var/lib/ceph/mon/ceph-a
mkdir
-p /var/lib/ceph/mds/ceph-a
6、启动
service ceph -a start
7、执行健康检查
ceph
health
8、磁盘用
ext4 出现 mount 5 错误
后来用
mkfs.xfs -f
/dev/sda7
就 好了。
9、在客户端上操作:
sudo
mkdir /mnt/mycephfs
sudo
mount -t ceph {ip-address-of-monitor}:6789:/ /mnt/mycephfs
三、ceph-deploy安装
1、下载
2、
apt-get install python-virtualenv
./bootstrap
3、
ceph-deploy install ubuntu1
4、
ceph-deploy new ubuntu1
5、
ceph-deploy mon
create
ubuntu1
6、
ceph-deploy gatherkeys
遇错提示没有keyring则执行:
ceph-deploy forgetkeys
会生成
{cluster-name}.client.admin.keyring
{cluster-name}.bootstrap-osd.keyring
{cluster-name}.bootstrap-mds.keyring
7、
ceph-deploy osd create ubuntu1:/dev/sdb1 (磁盘路径)
可能遇到错:
1、磁盘已经挂载,用umount
2、磁盘格式化问题,用fdisk分区,
mkfs.xfs -f /dev/sdb1 格式化
8、
ceph -s
可能遇到错误:
提示没有osd
health HEALTH_ERR 192 pgs stuck inactive; 192 pgs stuck unclean; no osds
则执行ceph osd create
9、
cluster faf5e4ae-65ff-4c95-ad86-f1b7cbff8c9a
health HEALTH_WARN 192 pgs degraded; 192 pgs stuck unclean
monmap e1: 1 mons at {ubuntu1=12.0.0.115:6789/0}, election epoch 1, quorum 0 ubuntu1
osdmap e10: 3 osds: 1 up, 1 in
pgmap v17: 192 pgs, 3 pools, 0 bytes data, 0 objects
1058 MB used, 7122 MB / 8181 MB avail
192 active+degraded
10、客户端挂摘