mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-25 00:50:15 +08:00
PRF
@geekpi
This commit is contained in:
parent
536171557b
commit
41f17d7690
@ -1,6 +1,6 @@
|
|||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: (geekpi)
|
[#]: translator: (geekpi)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: (wxy)
|
||||||
[#]: publisher: ( )
|
[#]: publisher: ( )
|
||||||
[#]: url: ( )
|
[#]: url: ( )
|
||||||
[#]: subject: (Deploy Ceph in a Raspberry Pi cluster)
|
[#]: subject: (Deploy Ceph in a Raspberry Pi cluster)
|
||||||
@ -9,8 +9,10 @@
|
|||||||
|
|
||||||
在树莓派集群中部署 Ceph
|
在树莓派集群中部署 Ceph
|
||||||
======
|
======
|
||||||
使用 ceph-ansible 安装 Ceph 存储,并将其部署在树莓派集群中。
|
|
||||||
![Vector, generic Raspberry Pi board][1]
|
> 使用 ceph-ansible 安装 Ceph 存储,并将其部署在树莓派集群中。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
[Ceph][2] 是一个开源软件存储平台,它在统一的存储集群中提供对象、块和文件系统存储。我第一次使用 Ceph 是在 [OpenStack 中集成它][3]的时候。一开始,我很困惑,既然存储设备广泛存在,为什么要使用 Ceph。但在使用了三年多之后,这个平台的稳定性和完整性一再证明了它的价值。
|
[Ceph][2] 是一个开源软件存储平台,它在统一的存储集群中提供对象、块和文件系统存储。我第一次使用 Ceph 是在 [OpenStack 中集成它][3]的时候。一开始,我很困惑,既然存储设备广泛存在,为什么要使用 Ceph。但在使用了三年多之后,这个平台的稳定性和完整性一再证明了它的价值。
|
||||||
|
|
||||||
@ -19,39 +21,32 @@
|
|||||||
**材料:**
|
**材料:**
|
||||||
|
|
||||||
1. 树莓派 4B 4GB 型号四台。
|
1. 树莓派 4B 4GB 型号四台。
|
||||||
2. 四张 32GB 的 microSD 卡(启动操作系统)
|
2. 四张 32GB 的 microSD 卡(用于启动操作系统)
|
||||||
3. 四个树莓派外壳,带风扇和散热片(非常重要)
|
3. 四个树莓派外壳,带风扇和散热片(非常重要)
|
||||||
4. 四个树莓派充电器
|
4. 四个树莓派充电器
|
||||||
5. 6 个 32GB U 盘(用于 Ceph OSD 节点)
|
5. 6 个 32GB U 盘(用于 Ceph OSD 节点)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
**架构:**
|
**架构:**
|
||||||
|
|
||||||
![Project architecture][5]
|
![Project architecture][5]
|
||||||
|
|
||||||
(Aaron John Canlas, [CC BY-SA 4.0][6])
|
|
||||||
|
|
||||||
关于配置:
|
关于配置:
|
||||||
|
|
||||||
* 前端和后端网络都在同一个子网中
|
* 前端和后端网络都在同一个子网中
|
||||||
* [Ceph Monitor][7] 软件使用 4GB 内存的树莓派 4B。
|
* [Ceph Monitor][7] 软件使用 4GB 内存的树莓派 4B。
|
||||||
* [Ceph OSD][8] 节点使用相同的树莓派型号,但有两个 U 盘用于 OSD 磁盘
|
* [Ceph OSD][8] 节点使用相同的树莓派型号,但有两个 U 盘用于 OSD 磁盘
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 使用 ceph-ansible 部署 Ceph
|
### 使用 ceph-ansible 部署 Ceph
|
||||||
|
|
||||||
使用 Ceph 的 Ansible 仓库可以让部署变得顺畅简单
|
使用 Ceph 的 Ansible 仓库可以让部署变得顺畅简单
|
||||||
|
|
||||||
#### 1\. 复制 ssh 密钥到所有服务器
|
#### 1、复制 ssh 密钥到所有服务器
|
||||||
|
|
||||||
我在所有的服务器上都有一个名为 `cephadmin` 的共同用户(在此背景下,每个树莓派都是一台服务器)。`cephadmin` 用户配置了无密码的 `sudo`,以方便工作。
|
我在所有的服务器上都有一个名为 `cephadmin` 的共同用户(在此背景下,每个树莓派都是一台服务器)。`cephadmin` 用户配置了无密码的 `sudo`,以方便工作。
|
||||||
|
|
||||||
使用 `ssh-keygen` 生成密钥后,使用 `ssh-copy-id` 部署所有密钥。
|
使用 `ssh-keygen` 生成密钥后,使用 `ssh-copy-id` 部署所有密钥。
|
||||||
|
|
||||||
我使用了一个Bash for 循环,因为我使用的是一致并递增的主机名:
|
我使用了一个 Bash `for` 循环,因为我使用的是一致并递增的主机名:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ for i in {0..3}; \
|
$ for i in {0..3}; \
|
||||||
@ -61,49 +56,43 @@ done
|
|||||||
|
|
||||||
你需要每个接受并输入密码,但你可以用 `expect` 来自动完成。
|
你需要每个接受并输入密码,但你可以用 `expect` 来自动完成。
|
||||||
|
|
||||||
#### 2\. 克隆 ceph-ansible 并安装依赖
|
#### 2、克隆 ceph-ansible 并安装依赖
|
||||||
|
|
||||||
安装 Git 来克隆仓库:
|
安装 Git 来克隆仓库:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ sudo yum install git -y`
|
$ sudo yum install git -y
|
||||||
```
|
```
|
||||||
|
|
||||||
克隆 ceph-ansible 仓库:
|
克隆 ceph-ansible 仓库:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ git clone <https://github.com/ceph/ceph-ansible.git>
|
$ git clone https://github.com/ceph/ceph-ansible.git
|
||||||
$ cd ceph-ansible/
|
$ cd ceph-ansible/
|
||||||
```
|
```
|
||||||
|
|
||||||
我使用的是 CentOS 7 的 AArch64 构建,所以在继续之前,我必须安装一些所需的包。
|
我使用的是 CentOS 7 的 AArch64 构建,所以在继续之前,我必须安装一些所需的包。
|
||||||
|
|
||||||
首先安装 Python pip:
|
首先安装 Python `pip`:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ sudo yum install python3-pip -y`
|
$ sudo yum install python3-pip -y
|
||||||
```
|
```
|
||||||
|
|
||||||
接着是 ceph-ansible 需要的包:
|
接着是 ceph-ansible 需要的包:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ sudo yum install python3-devel libffi-devel openssl-devel -y`
|
$ sudo yum install python3-devel libffi-devel openssl-devel -y
|
||||||
```
|
```
|
||||||
|
|
||||||
最后,`ceph-ansible` 需要的依赖:
|
最后,ceph-ansible 需要的依赖:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ pip3 install -r requirements.txt --user`
|
$ pip3 install -r requirements.txt --user
|
||||||
```
|
```
|
||||||
|
|
||||||
我收到了这个错误:
|
我收到了这个错误:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
You are linking against OpenSSL 1.0.2, which is no longer supported by the OpenSSL project.
|
You are linking against OpenSSL 1.0.2, which is no longer supported by the OpenSSL project.
|
||||||
To use this version of cryptography you need to upgrade to a newer version of OpenSSL. For
|
To use this version of cryptography you need to upgrade to a newer version of OpenSSL. For
|
||||||
@ -115,27 +104,24 @@ CRYPTOGRAPHY_ALLOW_OPENSSL_102 to allow OpenSSL 1.0.2.
|
|||||||
|
|
||||||
部署时,将 `CRYPTOGRAPHY_ALLOW_OPENSSL_102` 导出为 `True`,这样 Ansible 就可以运行了。
|
部署时,将 `CRYPTOGRAPHY_ALLOW_OPENSSL_102` 导出为 `True`,这样 Ansible 就可以运行了。
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ export CRYPTOGRAPHY_ALLOW_OPENSSL_102=True`
|
$ export CRYPTOGRAPHY_ALLOW_OPENSSL_102=True
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 3\. 配置 ceph-ansible 进行部署
|
#### 3、配置 ceph-ansible 进行部署
|
||||||
|
|
||||||
现在你可以使用 ceph-ansible 部署 Ceph 了。
|
现在你可以使用 ceph-ansible 部署 Ceph 了。
|
||||||
|
|
||||||
复制 `site.yml.sample` 到 `site.yml`:
|
复制 `site.yml.sample` 到 `site.yml`:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ mv site.yml.sample site.yml`
|
$ mv site.yml.sample site.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
在 `group_vars` 目录下创建 `all.yml`:
|
在 `group_vars` 目录下创建 `all.yml`:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cat << EOF >> group_vars/all.yml
|
$ cat << EOF >> group_vars/all.yml
|
||||||
ceph_origin: repository
|
ceph_origin: repository
|
||||||
ceph_repository: community
|
ceph_repository: community
|
||||||
ceph_repository_type: cdn
|
ceph_repository_type: cdn
|
||||||
@ -150,21 +136,19 @@ EOF
|
|||||||
|
|
||||||
在 `group_vars` 目录下创建 `osds.yml`:
|
在 `group_vars` 目录下创建 `osds.yml`:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cat << EOF >> group_vars/all.yml
|
$ cat << EOF >> group_vars/all.yml
|
||||||
osd_scenario: collocated
|
osd_scenario: collocated
|
||||||
devices:
|
devices:
|
||||||
- /dev/sda
|
- /dev/sda
|
||||||
\- /dev/sdb
|
- /dev/sdb
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
创建一个 inventory 文件:
|
创建一个 `inventory` 文件:
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cat << EOF >> inventory
|
$ cat << EOF >> inventory
|
||||||
[mons]
|
[mons]
|
||||||
rpi4b4-0
|
rpi4b4-0
|
||||||
|
|
||||||
@ -177,27 +161,23 @@ EOF
|
|||||||
|
|
||||||
在写这篇文章的时候,ceph-ansible 仓库里有一个 bug(根据这个 [bug 工单][9])。你可以通过编辑角色的第 85 行和第 86 行来减轻这个 bug。
|
在写这篇文章的时候,ceph-ansible 仓库里有一个 bug(根据这个 [bug 工单][9])。你可以通过编辑角色的第 85 行和第 86 行来减轻这个 bug。
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] | int > 0
|
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] | int > 0
|
||||||
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_up_osds"]
|
- (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_osds"] == (wait_for_all_osds_up.stdout | from_json)["osdmap"]["num_up_osds"]
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 4\. 部署 Ceph
|
#### 4、部署 Ceph
|
||||||
|
|
||||||
用你的 inventory 文件运行 Ansible playbook:
|
|
||||||
|
|
||||||
|
用你的 `inventory` 文件运行 Ansible 剧本:
|
||||||
|
|
||||||
```
|
```
|
||||||
`$ ansible-playbook -i inventory site.yml`
|
$ ansible-playbook -i inventory site.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
15-20 分钟后,你应该看到这个结果:
|
15-20 分钟后,你应该看到这个结果:
|
||||||
|
|
||||||
![Ceph deployment][10]
|
![Ceph deployment][10]
|
||||||
|
|
||||||
(Aaron John Canlas, [CC BY-SA 4.0][6])
|
|
||||||
|
|
||||||
### 下面的步骤
|
### 下面的步骤
|
||||||
|
|
||||||
之前,我在另一个树莓派集群中[手动部署][11]了一个 OpenStack 集群。我希望能将其与这个集群整合在一起。我也在研究用 [TripleO][12] 部署。
|
之前,我在另一个树莓派集群中[手动部署][11]了一个 OpenStack 集群。我希望能将其与这个集群整合在一起。我也在研究用 [TripleO][12] 部署。
|
||||||
@ -211,7 +191,7 @@ via: https://opensource.com/article/21/1/ceph-raspberry-pi
|
|||||||
作者:[AJ Canlas][a]
|
作者:[AJ Canlas][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[geekpi](https://github.com/geekpi)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user