当前位置: 首页 > news >正文

小白成长之路-centos7部署ceph存储

一、准备

5台centos7主机 

node节点双网卡

(1个内部检测,1个外部使用)

node节点都添加新网卡


关闭防火墙和上下文

都需要

添加hosts文件

都需要

  1. cat > /etc/hosts << EOF
  2. > 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
  3. > ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
  4. > 192.168.11.200 admin
  5. > 192.168.11.201 node01
  6. > 192.168.11.202 node02
  7. > 192.168.11.203 node03
  8. > 192.168.11.204 client
  9. > EOF
AI运行代码

admin对node免密

配时间同步

  1. timedatectl set-timezone Asia/Shanghai
  2. timedatectl set-ntp yes
  3. ###
  4. ntpdate ntp.aliyun.com
AI运行代码

创建工作目录

配置下载源

  1. wget https://download.ceph.com/rpm-nautilus/el7/noarch/ceph-release-1-1.el7.noarch.rpm --no-check-certificate
  2. rpm -ivh ceph-release-1-1.el7.noarch.rpm --force
AI运行代码

安装软件包及依赖

  1. curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
  2. curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
  3. yum clean all
  4. yum makecache
  5. yum -y install epel-release
  6. yum -y install yum-plugin-priorities yum-utils ntpdate python-setuptools python-pip gcc gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel zip unzip ncurses ncurses-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5-devel libidn libidn-devel openssl openssh openssl-devel nss_ldap openldap openldap-devel openldap-clients openldap-servers libxslt-devel libevent-devel ntp libtool-ltdl bison libtool vim-enhanced python wget lsof iptraf strace lrzsz kernel-devel kernel-headers pam-devel tcl tk cmake ncurses-devel bison setuptool popt-devel net-snmp screen perl-devel pcre-devel net-snmp screen tcpdump rsync sysstat man iptables sudo libconfig git bind-utils tmux elinks numactl iftop bwm-ng net-tools expect snappy leveldb gdisk python-argparse gperftools-libs conntrack ipset jq libseccomp socat chrony sshpass
AI运行代码

在admin执行

下载失败可手动下载

admin与node

  1. yum clean all
  2. yum mackcache
  3. yum -y install epel-release
  4. yum -y install yum-plugin-priorities
  5. yum -y install ceph-release ceph ceph-radosgw
AI运行代码

生成初始配置 

ceph-deploy new --public-network 192.168.11.0/24 --cluster-network 192.168.100.0/24 node01 node02 node03
AI运行代码

假如出现

  1. cat > /usr/lib/python2.7/site-packages/ceph_deploy/util/ssh.py << 'EOF'
  2. # -*- coding: utf-8 -*-
  3. import logging
  4. from ceph_deploy.lib import remoto
  5. from ceph_deploy.connection import get_local_connection
  6. def can_connect_passwordless(hostname):
  7. """
  8. Ensure that current host can SSH remotely to the remote
  9. host using the ``BatchMode`` option to prevent a password prompt.
  10. That attempt will error with an exit status of 255 and a ``Permission
  11. denied`` message or a``Host key verification failed`` message.
  12. """
  13. # 直接返回True,跳过needs_ssh检查(已确认SSH正常)
  14. return True
  15. # 以下代码会被上面的return跳过,保留仅作参考
  16. logger = logging.getLogger(hostname)
  17. with get_local_connection(logger) as conn:
  18. # Check to see if we can login, disabling password prompts
  19. command = ['ssh', '-CT', '-o', 'BatchMode=yes', hostname]
  20. out, err, retval = remoto.process.check(conn, command, stop_on_error=False)
  21. permission_denied_error = 'Permission denied '
  22. host_key_verify_error = 'Host key verification failed.'
  23. has_key_error = False
  24. for line in err:
  25. if permission_denied_error in line or host_key_verify_error in line:
  26. has_key_error = True
  27. if retval == 255 and has_key_error:
  28. return False
  29. return True
  30. EOF
AI运行代码

同步配置

ceph-deploy --overwrite-conf mon create-initial
AI运行代码

初始化mon节点

ceph-deploy mon create node01 node02 node03
AI运行代码

部署mgr

ceph-deploy mgr create node{01..03}
AI运行代码

查看ceph集群状态

查看 mon 集群选举的情况

ceph quorum_status --format json-pretty | grep leader
AI运行代码

擦净(删除分区表)磁盘
  1. ceph-deploy disk zap node01 /dev/sdb
  2. ceph-deploy disk zap node02 /dev/sdb
  3. ceph-deploy disk zap node03 /dev/sdb
AI运行代码

添加osd节点
  1. ceph-deploy --overwrite-conf osd create node01 --data /dev/sdb
  2. ceph-deploy --overwrite-conf osd create node02 --data /dev/sdb
  3. ceph-deploy --overwrite-conf osd create node03 --data /dev/sdb
AI运行代码

查看状态

开启监控模块

查看主节点
ceph -s | grep mgr
AI运行代码

在主节点上执行 
yum install -y ceph-mgr-dashboard
AI运行代码

  1. [root@admin ceph]# ceph config set mgr mgr/dashboard/ssl false
  2. [root@admin ceph]# ceph config set mgr mgr/dashboard/server_addr 0.0.0.0
  3. [root@admin ceph]# ceph config set mgr mgr/dashboard/server_port 8000
  4. [root@admin ceph]# ceph mgr module disable dashboard
  5. [root@admin ceph]# ceph mgr module enable dashboard --force
  6. [root@admin ceph]# ceph mgr services
AI运行代码

设置密码与用户 
  1. [root@admin ceph]# echo "123.com" > dashboard_passwd.txt
  2. [root@admin ceph]# ceph dashboard set-login-credentials admin -i dashboard_passwd.txt
AI运行代码

资源池 Pool 管理

创建pool,作为数据池
ceph osd pool create mypool 64 64
AI运行代码

安装客户工具
ceph-deploy install client
AI运行代码

客户端使用ceph

admin节点操作,安装客户端工具
[root@admin ceph]# ceph-deploy install client
AI运行代码

admin节点操作,同步管理信息
ceph-deploy admin  client
AI运行代码

在client节点操作,安装客户端工具

创建 元数据池
  1. ceph osd pool create cephfs_meta 64
  2. ceph osd pool application enable cephfs_meta cephfs
AI运行代码

使用 资源池与 元资源池 关联 创建 cephfs

使用 2个pool 一个作为资源池 (大容量)一个作为 元资源池 (小容量)

  1. ceph fs new cephfs cephfs_meta mypool
  2. ceph fs new <文件系统名称> <元数据池名称> <数据池名称>
AI运行代码

挂载文件 
ceph-fuse -k /etc/ceph/ceph.client.admin.keyring -m 192.168.11.201:6789 /ceph
AI运行代码


文章转载自:

http://TF3Uecvw.yrbLz.cn
http://ZG44Dsr6.yrbLz.cn
http://DBQlwwc6.yrbLz.cn
http://DNQMXmYk.yrbLz.cn
http://TSSGnKjm.yrbLz.cn
http://udeabxVa.yrbLz.cn
http://8RX6fn13.yrbLz.cn
http://QxP9sqff.yrbLz.cn
http://dt9MouWH.yrbLz.cn
http://j2iUMeQS.yrbLz.cn
http://JW6La4rf.yrbLz.cn
http://VQYELK99.yrbLz.cn
http://o1o28Uvp.yrbLz.cn
http://k8R3f2t8.yrbLz.cn
http://KnbCDYCA.yrbLz.cn
http://TULwbEOv.yrbLz.cn
http://RM2dsVBL.yrbLz.cn
http://EaaKt8QG.yrbLz.cn
http://io1EDYk8.yrbLz.cn
http://8D7MmAfT.yrbLz.cn
http://26OUtnXq.yrbLz.cn
http://3VZ0DMzh.yrbLz.cn
http://t6RtObyU.yrbLz.cn
http://VHIFOa1q.yrbLz.cn
http://4M9Kzrsc.yrbLz.cn
http://US6MabZS.yrbLz.cn
http://4FP6xCAn.yrbLz.cn
http://S01LKK0d.yrbLz.cn
http://Ol2tabiR.yrbLz.cn
http://tLPYuoYu.yrbLz.cn
http://www.dtcms.com/a/377440.html

相关文章:

  • python学习进阶之面向对象(二)
  • 【芯片设计-信号完整性 SI 学习 1.1.1 -- Unit Interval,比特周期】
  • sudo apt update sudo apt upgrade -y 两个命令的作用
  • 每日算法刷题Day68:9.10:leetcode 最短路6道题,用时2h30min
  • apache详细讲解(apache介绍+apache配置实验+apache实现https网站)
  • 一些常用的激活函数及绘图
  • 第3节-使用表格数据-数据库设计
  • 同步时钟系统在体育场游泳馆的应用
  • QT里获取UUID当做唯一文件名称
  • 【Python】pytorch数据操作
  • iOS应用启动深度解析:dyld动态链接器的工作机制与优化实践
  • [硬件电路-175]:multisim中如何给让光电二极管产生光电流?
  • 小巧精准,安全无忧:安科瑞ADL200N-CT/D16-WF防逆流电表守护阳台光伏
  • NLP(自然语言处理, Natural Language Processing)
  • 【竞赛系列】机器学习实操项目07——全球城市计算AI挑战赛(baseline、时间序列分析、地铁流量预测)
  • 华为昇腾CANN开发实战:算子自定义与模型压缩技术指南
  • Java 多线程(二)
  • TCGA(The Cancer Genome Atlas)数据库是癌症基因组学研究的重要资源,包含了多种癌症类型的基因组、转录组、表观基因组和临床数据
  • 单片机与PLC:定义、异同及替代可能性解析
  • 金融知识:投资和融资
  • 重学前端013 --- 响应式网页设计 CSS网格布局
  • hCaptcha 图像识别 API 对接说明
  • 大模型应用开发八股
  • Linux进程概念(上):进程基本概念和进程状态
  • 汽车EPAS ECU功能安全建模分析:Gamma框架+深度概率编程落地ISO 26262(含寿命预测案例)
  • 深入解析:ES6 中 class 与普通构造器的区别
  • 华清远见25072班网络编程学习day3
  • QT(3)
  • 具有区域引导参考和基础的大型语言模型,用于生成 CT 报告
  • 【QT】-怎么实现瀑布图