ceph install in CentOS 7 x64 within docker - 2

接着上一篇

http://blog.163.com/digoal@126/blog/static/163877040201410269169450/

接下来要准备deploy节点和node的环境.

一. 部署ceph-deploy节点 : 

[root@localhost ~]# ssh 172.17.0.1
root@172.17.0.1's password:
Last login: Thu Nov 27 15:05:54 2014 from 172.17.42.1
[root@65a05647c55d ~]# yum install -y ceph-deploy

二. 部署node (所有node节点需执行, 包括deploy节点) : 

The admin node must be have password-less SSH access to Ceph nodes. When ceph-deploy logs in to a Ceph node as a user, that particular user must have passwordless sudo privileges.
The ceph-deploy utility must login to a Ceph node as a user that has passwordless sudo privileges, because it needs to install software and configuration files without prompting for passwords.

1. 配置时钟同步(本例docker环境中不需要)

# crontab -e
8 * * * * /usr/sbin/ntpdate asia.pool.ntp.org && /sbin/hwclock --systohc

2. 安装ssh server(本例docker环境中不需要,已安装)

yum install -y openssh-server openssh-clients

3. 创建一个ceph用户, 用于deploy节点对node节点进行管理. (deploy节点也需要创建这个用户)

[root@localhost ~]# ssh 172.17.0.2
root@172.17.0.2's password:
Last login: Thu Nov 27 15:06:29 2014 from 172.17.42.1
[root@136dd8993abd ~]# useradd ceph
设置密码
[root@136dd8993abd ~]# echo 'ceph:cephpwd' | chpasswd
配置sudo
[root@136dd8993abd ~]# yum install -y sudo
[root@136dd8993abd ~]# echo "ceph ALL = (root) NOPASSWD:ALL" | sudo tee /etc/sudoers.d/ceph
验证sudo 配置是否正确
[root@136dd8993abd ~]# su - ceph
[ceph@136dd8993abd ~]$ sudo date
Thu Nov 27 15:41:53 GMT 2014
..............

4. 生成deploy节点ceph用户的ssh key

当前为deploy节点 : 

[root@deploy ~]# ip addr show v1
64: v1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 4a:e5:cd:99:f5:c8 brd ff:ff:ff:ff:ff:ff
    inet 172.17.0.1/16 scope global v1
       valid_lft forever preferred_lft forever
    inet6 fe80::48e5:cdff:fe99:f5c8/64 scope link
       valid_lft forever preferred_lft forever

在ceph用户下生成key, 不要输入passphrase : 

[root@deploy ~]# su - ceph
Last login: Fri Nov 28 11:14:46 GMT 2014 on pts/0
[ceph@deploy ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/ceph/.ssh/id_rsa):
Created directory '/home/ceph/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/ceph/.ssh/id_rsa.
Your public key has been saved in /home/ceph/.ssh/id_rsa.pub.
The key fingerprint is:
32:3b:89:89:36:28:e7:01:3e:1b:80:ce:70:de:ca:34 ceph@deploy
The key's randomart image is:
+--[ RSA 2048]----+
|                 |
|                 |
|                 |
|.                |
|= .   o S        |
|*= o o =         |
|o*E + +          |
|.*+=   .         |
| .+              |
+-----------------+

将ceph用户的key拷贝到所有节点(包括自己)的ceph用户下面 : 

[ceph@deploy ~]$ ssh-copy-id ceph@172.17.0.1
....................
[ceph@deploy ~]$ ssh-copy-id ceph@172.17.0.8

The authenticity of host '172.17.0.8 (172.17.0.8)' can't be established.
ECDSA key fingerprint is db:5c:6b:2a:bc:9e:3e:31:24:1b:c0:8d:5f:96:f2:e0.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
ceph@172.17.0.8's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'ceph@172.17.0.8'"
and check to make sure that only the key(s) you wanted were added.
..................
测试是否无需密码调用ceph.
[ceph@deploy ~]$ ssh ceph@172.17.0.1 date
Fri Nov 28 11:22:04 GMT 2014
[ceph@deploy ~]$ ssh ceph@172.17.0.2 date
Fri Nov 28 11:22:06 GMT 2014
[ceph@deploy ~]$ ssh ceph@172.17.0.3 date
Fri Nov 28 11:22:08 GMT 2014
[ceph@deploy ~]$ ssh ceph@172.17.0.4 date
Fri Nov 28 11:22:09 GMT 2014
[ceph@deploy ~]$ ssh ceph@172.17.0.5 date
Fri Nov 28 11:22:10 GMT 2014
[ceph@deploy ~]$ ssh ceph@172.17.0.6 date
Fri Nov 28 11:22:12 GMT 2014
[ceph@deploy ~]$ ssh ceph@172.17.0.7 date
Fri Nov 28 11:22:13 GMT 2014
[ceph@deploy ~]$ ssh ceph@172.17.0.8 date
Fri Nov 28 11:22:15 GMT 2014

5. 配置nodes的网络自动启动(本例不需要配置) : 

Ceph OSDs peer with each other and report to Ceph Monitors over the network. If networking is off by default, the Ceph cluster cannot come online during bootup until you enable networking.

The default configuration on some distributions (e.g., CentOS) has the networking interface(s) off by default. Ensure that, during boot up, your network interface(s) turn(s) on so that your Ceph daemons can communicate over the network. For example, on Red Hat and CentOS, navigate to /etc/sysconfig/network-scripts and ensure that the ifcfg-{iface} file has ONBOOT set to yes.

6. 配置主机名连通性, 在所有节点包括deploy节点执行.

[root@deploy ~]# yum install -y hostname
[root@deploy ~]# vi /etc/hosts
172.17.0.1      deploy
172.17.0.2      mon1
172.17.0.3      mon2
172.17.0.4      mon3
172.17.0.5      osd1
172.17.0.6      osd2
172.17.0.7      osd3
172.17.0.8      osd4
127.0.0.1       localhost
.......................

7. 配置防火墙(本例已打开, 不需要添加条目)

Ceph Monitors communicate using port 6789 by default. Ceph OSDs communicate in a port range of 6800:7810 by default. See the Network Configuration Reference for details. Ceph OSDs can use multiple network connections to communicate with clients, monitors, other OSDs for replication, and other OSDs for heartbeats.

On some distributions (e.g., RHEL), the default firewall configuration is fairly strict. You may need to adjust your firewall settings allow inbound requests so that clients in your network can communicate with daemons on your Ceph nodes.

For firewalld on RHEL 7, add port 6789 for Ceph Monitor nodes and ports 6800:7100 for Ceph OSDs to the public zone and ensure that you make the setting permanent so that it is enabled on reboot. For example:

sudo firewall-cmd --zone=public --add-port=6789/tcp --permanent

For iptables, add port 6789 for Ceph Monitors and ports 6800:7100 for Ceph OSDs. For example:

sudo iptables -A INPUT -i {iface} -p tcp -s {ip-address}/{netmask} --dport 6789 -j ACCEPT

Once you have finished configuring iptables, ensure that you make the changes persistent on each node so that they will be in effect when your nodes reboot. For example:

/sbin/service iptables save

8. 配置tty. (所有节点)

[root@deploy ~]# visudo -f /etc/sudoers
注释
#Defaults    requiretty

9. 关闭selinux(所有节点)

# setenforce 0
# vi /etc/selinux/config
SELINUX=disabled

10. 添加epel源(所有节点)

http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/repoview/epel-release.html

http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm

[root@  ~]# yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm

[ceph@deploy ~]$ ssh 172.17.0.1 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[ceph@deploy ~]$ ssh 172.17.0.2 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[ceph@deploy ~]$ ssh 172.17.0.3 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[ceph@deploy ~]$ ssh 172.17.0.4 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[ceph@deploy ~]$ ssh 172.17.0.5 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[ceph@deploy ~]$ ssh 172.17.0.6 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[ceph@deploy ~]$ ssh 172.17.0.7 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm
[ceph@deploy ~]$ ssh 172.17.0.8 sudo yum install -y http://ftp.cuhk.edu.hk/pub/linux/fedora-epel/7/x86_64/e/epel-release-7-2.noarch.rpm

[参考]
1. http://blog.163.com/digoal@126/blog/static/163877040201410269169450/

2. http://blog.163.com/digoal@126/blog/static/1638770402014102711413675/

时间: 2024-12-03 20:23:48

ceph install in CentOS 7 x64 within docker - 2的相关文章

ceph install in CentOS 7 x64 within docker - 1

本文使用docker来部署ceph, 基于CentOS 7 x64. 首先要安装docker, CentOS 7源已经包含了docker, 所以可以直接使用yum安装. # yum install -y docker 配置docker 运行时的root目录(-g 参数). [root@localhost ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert lv01 vgdata01 -wi-ao---- 409

ceph install in CentOS 7 x64 within docker - 4

前面已经部署好了monitor, 接下来要部署4台osd节点. osd节点需要注意osd数据目录, 建议挂载到独立的硬盘, journal建议放到ssd中. 如果一个主机有多个硬盘并且没有使用lvm来管理条带的话, 建议启动多个osd daemon, 分别挂载到他们的数据目录. Once you have your initial monitor(s) running, you should add OSDs. Your cluster cannot reach an active + clea

ceph install in CentOS 7 x64 within docker - 3

部署ceph cluster的第一步是部署monitor节点, 本例我们使用3台monitor. 并且monitor之间使用cephx认证. INSTALL CEPH STORAGE CLUSTER 1. 安装yum-plugin-priorities  (所有节点) [root@deploy yum.repos.d]# su - ceph [ceph@deploy ~]$ ssh 172.17.0.1 sudo yum install -y yum-plugin-priorities [cep

Centos 7 快速安装 Docker

安装 Docker [root@localhost~]# yum install docker 启动 docker 服务 [root@localhost~]# systemctl start docker.service [root@localhost~]# systemctl enable docker.service 安装 centos 镜像 [root@localhost~]# docker pull centos Using default tag: latest Trying to p

CentOS 7 x64下Apache+MySQL(Mariadb)+PHP56的安装教程详解_Linux

每次搭建新服务器,都要来来回回把这些包再装一下,来来回回搞了不下20遍了吧,原来都是凭经验,配置过程中重复入坑是难免的,故写此文做个备忘.虽然有像xampp这样的集成包,但是在生产环境的Linux发行版上,还是通过包管理工具安装会放心.这次新买的服务器是CentOS 7(7.2)系统,相关配置也都以此版本为主,为方便操作,直接使用root用户配置. CentOS 7的源比较旧,自带的PHP是PHP 5.4,我们想要的是PHP 5.6,这就需要执行以下命令添加额外的remi源. rpm -ivh

如何在 CentOS 7 上安装 Docker

如何在 CentOS 7 上安装 Docker Docker 是一个开源工具,它可以让创建和管理 Linux 容器变得简单.容器就像是轻量级的虚拟机,并且可以以毫秒级的速度来启动或停止.Docker 帮助系统管理员和程序员在容器中开发应用程序,并且可以扩展到成千上万的节点. 容器和 VM(虚拟机)的主要区别是,容器提供了基于进程的隔离,而虚拟机提供了资源的完全隔离.虚拟机可能需要一分钟来启动,而容器只需要一秒钟或更短.容器使用宿主操作系统的内核,而虚拟机使用独立的内核. Docker 的局限性之

Centos 7.x 使用Docker registry镜像创建私有仓库

有时候使用 Docker Hub 这样的公共仓库可能不方便,并且公司的私有镜像为了业务安全,也不会push到docker hub上,用户可以创建一个本地仓库供私人使用.类似于git 和maven一样,同时节省服务器下载和上传镜像带宽. 那什么是docker registry呢 Docker Registry由三个部分组成:index,registry,registry client. 可以把Index认为是负责登录.负责认证.负责存储镜像信息和负责对外显示的外部实现,而registry则是负责存

Drupal 7.28, Nginx 1.6, PostgreSQL 9.3.4, PHP 5.4, fpm install on CentOS 6.x x64

安装Drupal的系统需求, 需要web server, database, php. https://www.drupal.org/requirements 本文以Drupal 7.28, Nginx 1.6, PostgrSQL 9.3.4, PHP 5.4为例写一下Drupal的部署. 不涉及任何优化, 例如使用fpm, 用unix sock连接效率会更高. 安装参考 https://www.drupal.org/documentation/install 一. nginx 安装, 本文选

keepalived install in CentOS 6.x x64

下载最新稳定版本 # wget http://www.keepalived.org/software/keepalived-1.2.13.tar.gz # tar -zxvf keepalived-1.2.13.tar.gz # cd keepalived-1.2.13 查看INSTALL, 了解requirement Kernel needing ============== Compile a kernel with the following options : Kernel/User n