【运维笔记】ceph

version

ceph version 13.2.8 (5579a94fafbc1f9cc913a0f5d362953a5d9c3ae0) mimic (stable)

命令

# 查看ceph集群状态
ceph -s

# 显示OSD利用率
ceph osd df

用户管理

## 配置文件
	.s3cfg

## 创建用户
radosgw-admin user create --uid=user_name --display-name="display_name"

## 获取用户信息
radosgw-admin user info --uid=user_name

## 停用用户
radosgw-admin user suspend --uid=user_name

## 启用被停用的用户
radosgw-admin user enable --uid=user_name

## 删除用户
radosgw-admin user rm --uid=user_name

ceph部署(1mon + 3osd)

## 更改hostname
hostnamectl set-hostname ceph

## 更改hosts,不修改可能无法正常解析
192.168.42.133  mon01
192.168.42.134  osd01

## 安装epel-release
ceph需要第三方库支持
	
## 新建ceph.repo
[Ceph]
name=Ceph packages for $basearch
baseurl=https://mirrors.huaweicloud.com/ceph/rpm-mimic/el7/$basearch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc

[Ceph-noarch]
name=Ceph noarch packages
baseurl=https://mirrors.huaweicloud.com/ceph/rpm-mimic/el7/noarch
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc

[ceph-source]
name=Ceph source packages
baseurl=https://mirrors.huaweicloud.com/ceph/rpm-mimic/el7/SRPMS
enabled=1
gpgcheck=1
type=rpm-md
gpgkey=https://download.ceph.com/keys/release.asc

## 安装ceph-deploy部署工具(ceph-admin)
	yum -y install ceph-deploy

## monitor
	### 安装ceph,ceph-deploy工具安装,或者手动安装ceph ceph-deploy ceph-radosgw-admin
	ceph-deploy install mon01
		
	### 开始部署新monitor集群(当前目录下生成文件ceph.conf、ceph.mon.keyring)
	ceph-deploy new mon01
		
	### 修改配置文件 ceph.conf([ERROR ] admin_socket)
	public_network= 10.8.8.0/24
	
	### 初始monitors
	ceph-deploy mon create-initial

	### 推送admin秘钥(ERROR: missing keyring, cannot use cephx for authentication)
	ceph-deploy admin mon01

### mgr
ceph-deploy mgr create mon01

## OSD			
	### 准备存储设备
	/dev/sdb  # 新盘
	/dev/sdb1 /dev/sdb2 /dev/sdb3  # 3个分区

	### 添加osd
	### ceph-deploy osd create {node} --data /path/to/device
	ceph-deploy osd create osd01 --data /dev/sdb1
	ceph-deploy osd create osd01 --data /dev/sdb2
	ceph-deploy osd create osd01 --data /dev/sdb3

## RADOS块设备(RBD)
## ceph文件系统(CephFS)
## RADOSGW(S3)

常见报错

## 不支持ipv6报错
[ceph][ERROR ] "ceph auth get-or-create for keytype admin returned 1
[ceph][DEBUG ] unable to parse addrs in 'fe80::28d1:26a6:7848:482%ens33'
# /etc/hosts 中手动添加解析

## 时间错误报错
64 pgs are stuck inactive for more than 300 seconds
64 pgs stuck inactive
64 pgs stuck unclean

你可能感兴趣的:(分布式存储)