[关闭]
@zhangyy 2021-11-07T13:15:46.000000Z 字数 4378 阅读 124

leofs 分布式存储

运维系列



一: leofs 介绍

1.1: leofs 介绍

  1. 软件简介:
  2. LeoFS是一个高可靠性,最终一致性的分布式对象存储系统,主要功能如下:
  3. 支持多种协议: S3 REST NFS
  4. 支持大对象和小对象
  5. 内置缓存机制
  6. 多数据中心复制
  7. 自动运维支持
  8. 1. 多协议
  9. S3-api REST-apiNFS
  10. 2. 小文件/大文件
  11. 能处理超过GB级文件
  12. 3. 多数据中心复制
  13. leofs 是一个具有高度扩展性,容错的分布式文件系统,无插件,leofs 集群可以被看做是一个大容量存储,它由一组松散连接的节点组成.
  14. github地址:
  15. https://github.com/leo-project/leofs
  16. 官网:
  17. https://leo-project.net/leofs/

image_1fjs1rn2t6id1668n9cenf362m.png-77.2kB

image_1fjs1gtn7mig1kp41s5t17tq1g169.png-779.1kB

image_1fjs1uejf18diee0v7r1b1a1nmr13.png-1196.3kB

1.2: leofs 组成 部分

  1. leofs 3个核心应用组成,leofs_storage, leofs_gateway, leofs_manager 组成

image_1fjs20ii616lf1k7k1sej6kk9h01g.png-583.2kB

二: leofs 安装

2.1 下载

  1. https://leo-project.net/leofs/download.html

image_1fjs2cj6sdgbion175v1rp71nie1t.png-188.8kB

2.2 系统介绍

  1. 系统: centOS7.9x64
  2. 主机名:
  3. cat /etc/hosts
  4. ----
  5. 192.168.100.11 flyfishsrvs01
  6. 192.168.100.12 flyfishsrvs02
  7. 192.168.100.13 flyfishsrvs03
  8. 192.168.100.14 flyfishsrvs04
  9. 192.168.100.15 flyfishsrvs05
  10. 192.168.100.16 flyfishsrvs06
  11. 192.168.100.17 flyfishsrvs07
  12. ----
  13. 本次安装采用前三台虚拟机

2.3 leofs 安装

2.3.1 安装leofs包

  1. 1. 安装依赖包:
  2. 依赖环境: 【全部节点安装】
  3. yum install gcc gcc-c++ glibc-devel make ncurses-devel openssl-devel autoconf libuuid-devel cmake check check-devel wget curl git gcc* vim nc redhat-lsb -y
  4. yum --enablerepo=centosplus install kmod-xfs xfsprogs xfsprogs-devel -y
  5. rpm -ivh leofs-1.4.3-1.el7.x86_64.rpm

image_1fjs32pqp16e81jdc1m539od149f2a.png-120.9kB

image_1fjs33ngi1boepdge91linaid2n.png-120.6kB

image_1fjs346i6r0k8419bk1k0u56m37.png-144.4kB


  1. 安装目录:
  2. cd /usr/local/leofs/
  3. ls -ld *

image_1fjs35qge1g181e1pee91v8cmbr3k.png-73.2kB

image_1fjs37f8h104c1pib1o041ns0138f41.png-87.2kB

image_1fjs380eu1i7o1aes18hvphrevt4e.png-67.3kB

2.3.2 配置leofs

  1. 配置管理节点:
  2. 192.168.100.11: manager01
  3. cd /usr/local/leofs/1.4.3/leo_manager_0/etc
  4. cp -p leo_manager.conf leo_manager.conf.bak
  5. vim leo_manager.conf
  6. ---
  7. manager.partner = manager_1@192.168.100.11
  8. system.dc_id = dc_1
  9. system.cluster_id = leofs_cluster # 集群名字
  10. consistency.num_of_replicas = 3 # 集群的副本集
  11. consistency.write = 1
  12. consistency.read = 1
  13. consistency.delete = 1
  14. consistency.rack_aware_replicas = 0
  15. nodename = manager_0@192.168.100.11
  16. ---

image_1fjs3fr2i7g1miptnd5h1km54r.png-76.6kB

image_1fjs3gdgecpopb21c511oi9ij58.png-54.2kB

image_1fjs3hbcruch6ij8os1ha51sdr5l.png-57.5kB

  1. 192.168.100.12 manager02:
  2. cd /usr/local/leofs/1.4.3/leo_manager_1/etc
  3. cp -p leo_manager.conf leo_manager.conf.bak
  4. vim leo_manager.conf
  5. manager.partner = manager_0@192.168.100.11
  6. nodename = manager_1@192.168.100.12

image_1fjs3loo17btcs31v361b3dai66f.png-50.7kB

image_1fjs3l0vbch6a46oeepd9hfk62.png-79.8kB

2.3.3 配置 存储节点

  1. 所有节点创建存储目录
  2. mkdir /data/leofs -p
  3. chmod 777 -R /data/leofs

image_1fjs4tdiqjk5niv173b1m2t1lrb9q.png-39.2kB

image_1fjs4ttus1for1pgd1okn1phbb9ua7.png-51.6kB

image_1fjs4u8j0e5ctm31buehctji1ak.png-81.5kB

  1. 存储节点:
  2. 192.168.100.11
  3. cd /usr/local/leofs/1.4.3/leo_storage/etc
  4. cp -p leo_storage.conf leo_storage.conf.bak
  5. vim leo_storage.conf
  6. -----
  7. managers = [manager_0@192.168.100.11, manager_1@192.168.100.12]
  8. obj_containers.path = [/data/leofs] #### 有大硬盘 挂在这个目录下面
  9. nodename = storage_1@192.168.100.11
  10. -----

image_1fjs410rsuic1j1knjb318gpa6s.png-74.2kB

image_1fjs425ko78eqru1skf1drhgdn79.png-60.3kB


  1. 192.168.100.12:
  2. cd /usr/local/leofs/1.4.3/leo_storage/etc
  3. cp -p leo_storage.conf leo_storage.conf.bak
  4. vim leo_storage.conf
  5. ----
  6. managers = [manager_0@192.168.100.11, manager_1@192.168.100.12]
  7. obj_containers.path = [/data/leofs] #### 有大硬盘 挂在这个目录下面
  8. nodename = storage_2@192.168.100.12
  9. -----

image_1fjs4b2g714j2f0dk64gopag83.png-61.9kB

image_1fjs49tus1m1614a917ml19bt1eul7m.png-41.4kB

  1. 192.168.100.13:
  2. cd /usr/local/leofs/1.4.3/leo_storage/etc
  3. cp -p leo_storage.conf leo_storage.conf.bak
  4. vim leo_storage.conf
  5. ---
  6. managers = [manager_0@192.168.100.11, manager_1@192.168.100.12]
  7. obj_containers.path = [/data/leofs] #### 有大硬盘 挂在这个目录下面
  8. nodename = storage_3@192.168.100.13
  9. ---

image_1fjs4irto6e1ka86g1ugi1bpf8t.png-71.1kB

image_1fjs4guh4sgt6v3b7f1c2t12608g.png-54.2kB

2.3.4 配置leofs 的gateway 的节点:

  1. Gateway节点:
  2. 192.168.100.13
  3. cd /usr/local/leofs/1.4.3/leo_gateway/etc
  4. cp -p leo_gateway.conf leo_gateway.conf.bak
  5. vim leo_gateway.conf
  6. managers = [manager_0@192.168.100.11, manager_1@192.168.100.12]
  7. protocol = s3
  8. http.port = 8080
  9. cache.cache_ram_capacity = 268435456
  10. cache.cache_disc_capacity = 0
  11. cache.cache_expire = 300
  12. cache.cache_max_content_len = 1048576
  13. nodename = gateway_01@192.168.100.13
  14. cache.cache_disc_dir_data = ./cache/data
  15. cache.cache_disc_dir_journal = ./cache/journal

image_1fjs57hbk1c171oh7jd61vsbas4be.png-61.6kB

image_1fjs587b0qfe1ibrkfu1pki5aabr.png-48.4kB

image_1fjs56obt1tr319ps1ji41bd71hneb1.png-77.1kB

2.3.5 启动leofs:

  1. Manager-master
  2. 192.168.100.11
  3. /usr/local/leofs/1.4.3/leo_manager_0/bin/leo_manager start
  4. /usr/local/leofs/1.4.3/leo_manager_0/bin/leo_manager ping
  5. Manager-slave :
  6. 192.168.100.12
  7. /usr/local/leofs/1.4.3/leo_manager_1/bin/leo_manager start
  8. /usr/local/leofs/1.4.3/leo_manager_1/bin/leo_manager ping

image_1fjs5g542rd4t4trgdfgp18o5c8.png-63.8kB

image_1fjs5hfuq1q4e4il197efdtoklcl.png-64.6kB

  1. Storage nodes (全部节点:)
  2. /usr/local/leofs/1.4.3/leo_storage/bin/leo_storage start
  3. /usr/local/leofs/1.4.3/leo_storage/bin/leo_storage ping

image_1fjs8n84g1egu18bd193n19vps1sds.png-49.4kB

image_1fjs8mog1sua77htb9c8k1bn4df.png-45.7kB

image_1fjs8l7b5k7qiqgkl6gjqp9d2.png-55.9kB

  1. 检查会在 /data/leofs 生成文件:

image_1fjs8ojngu0s1d0f1nva1ak2kv4e9.png-100.4kB

image_1fjs8rt4k1ad9v3d1efg1re8lc4fm.png-91.2kB

image_1fjs8u3mpkpe1fvk14175fvl9qg3.png-127kB

  1. /usr/local/leofs/1.4.3/leofs-adm status

image_1fjs94c0s8u88rc1ihvs9u1l27gg.png-93.1kB

image_1fjs959c81tn11rfjem31kq1170ngt.png-105.4kB

  1. 启动gateway
  2. 192.168.100.13
  3. 启动gateway
  4. Gateway(s)
  5. 192.168.100.13
  6. /usr/local/leofs/1.4.3/leo_gateway/bin/leo_gateway start
  7. /usr/local/leofs/1.4.3/leo_gateway/bin/leo_gateway ping

image_1fjs984tjbkb4mdtai1mj7q7mha.png-68.1kB

  1. 存储驱动启动:
  2. 192.168.100.11 主节点:
  3. /usr/local/leofs/1.4.3/leofs-adm start

image_1fjs9akkf1c9ibbbf98gtf5hn.png-79.4kB

  1. /usr/local/leofs/1.4.3/leofs-adm status

image_1fjs9c7oh1t7gbrj66d1gp31e29i4.png-124kB

image_1fjs9d99akf0u33abuqa3161kih.png-119.9kB

2.3.6 创建用户与常用命令:

  1. 创建使用用户:
  2. 开发的代码配置文件要链接这个
  3. cd /usr/local/leofs/1.4.3/
  4. leofs-adm create-user flyfish 123456
  5. ---
  6. access-key-id: 974a465ec459e68ffc1f
  7. secret-access-key: 08eef244ef1d9e102c1a471c9c323b5da6d040b2
  8. ----
  9. leofs-adm add-bucket admin-project 974a465ec459e68ffc1f

image_1fjs9jm6g1k125gdg6peaeiu9iu.png-197.3kB

  1. 一些常用命令:
  2. 用户查询 get-users
  3. /usr/local/leofs/1.4.3/leofs-adm get-users

image_1fjs9u9lpro6177ujgs1ad6199ujb.png-84.8kB

  1. 删除用户:
  2. delete-user <user-id>
  3. /usr/local/leofs/1.4.3/leofs-adm delete-user flyfish

image_1fjsa2nkvla91a051rg9ck5l53jo.png-165kB

  1. 创建用户
  2. create-user <user-id> <password>
  3. /usr/local/leofs/1.4.3/leofs-adm create-user zhangyy 123456

image_1fjsa5q1j175k13r4pk21fqe1qh4k5.png-68.6kB

image_1fjsa6fl1oii1vflvlvf2t1hq2ki.png-69.7kB

  1. endpoint 端点:
  2. /usr/local/leofs/1.4.3/leofs-adm add-endpoint 192.168.100.11
  3. OK

image_1fjsafgkf12na1nghvfj1jc11v41kv.png-103.7kB

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注