• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

16.部署swift服务|swift配置存储和ring

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

每个服务都需要做的如下:

配置服务的时候,步骤如下:

  1. 创建服务同名的用户(除了keystone),添加到services这个project和admin这个role
  2. 创建services和endpoint
  3. 修改配置文件:需要指定keystone和rabbitmq的地址
  4. 更新数据库(除了swift)

 

swift是用不到上面的数据库的。

 

安装swift软件包

 

 

Memcached 是一个高性能的分布式内存对象缓存系统,用于动态Web应用以减轻数据库负载。它通过在内存中缓存数据和对象来减少读取数据库的次数,从而提高动态、数据库驱动网站的速度。

 

 

 

创建服务同名用户:

# openstack user create swift --password redhat

添加swift用户admin权限:

# openstack role add --user swift --project services admin

 

创建服务:

# openstack service create --name swift object-store

 

创建endpoint:

openstack endpoint create --region RegionOne --publicurl 'http://192.168.179.140:8080/v1/AUTH_%(tenant_id)s' --internalurl 'http://192.168.179.140:8080/v1/AUTH_%(tenant_id)s' --adminurl 'http://192.168.179.140:8080'  32103224f7054cb1a75e57f80c7037d5

 

修改配置文件:

/etc/swift/

 

配置的服务:

服务介绍:

代理服务器 proxy server

负责swift各个组件之间的通信

接收用户的请求

存储服务器:

容器服务

对象服务

账户服务

一致性服务:

auditor  定期检查zone1和zone2 之间数据有没有问题,是否损坏

replicate 复制,修复数据

update    如果修复没有成功,就会等一段时间再次修复,这个功能是由update来完成的

 

修改配置文件:

 

 

 

 

 

 

 

随机生成一个值

 

准备底层磁盘:

[[email protected] ~]# lsblk

NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

sda      8:0    0  100G  0 disk

©À©¤sda1   8:1    0   60G  0 part /

©¸©¤sda2   8:2    0    4G  0 part [SWAP]

sr0     11:0    1  3.8G  0 rom  /iso

[[email protected] ~]# fdisk /dev/sda

Welcome to fdisk (util-linux 2.23.2).

 

Changes will remain in memory only, until you decide to write them.

Be careful before using the write command.

 

 

Command (m for help): p

 

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors

Units = sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk label type: dos

Disk identifier: 0x00062bf0

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *        2048   125831167    62914560   83  Linux

/dev/sda2       125831168   134219775     4194304   82  Linux swap / Solaris

 

Command (m for help): n

Partition type:

   p   primary (2 primary, 0 extended, 2 free)

   e   extended

Select (default p): p

Partition number (3,4, default 3):

First sector (134219776-209715199, default 134219776):

Using default value 134219776

Last sector, +sectors or +size{K,M,G} (134219776-209715199, default 209715199): +15G

Partition 3 of type Linux and of size 15 GiB is set

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

 

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.

The kernel still uses the old table. The new table will be used at

the next reboot or after you run partprobe(8) or kpartx(8)

Syncing disks.

[[email protected] ~]# partprobe

Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.

Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.

Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0 has been opened read-only.

[[email protected] ~]#

 

 

创建逻辑卷:

[[email protected] ~]# pvs

[[email protected] ~]# pvcreate /dev/sda3

  Physical volume "/dev/sda3" successfully created

[[email protected] ~]# vgcreate vg0 /dev/sda3

  Volume group "vg0" successfully created

[[email protected] ~]# pvs

  PV         VG   Fmt  Attr PSize  PFree

  /dev/sda3  vg0  lvm2 a--  15.00g 15.00g

[[email protected] ~]# vgs

  VG   #PV #LV #SN Attr   VSize  VFree

  vg0    1   0   0 wz--n- 15.00g 15.00g

[[email protected] ~]# lvs

[[email protected] ~]# lvcreate -L 2G -n lv1 vg0

  Logical volume "lv1" created.

[[email protected] ~]# lvcreate -L 2G -n lv2 vg0

  Logical volume "lv2" created.

[[email protected] ~]# lvcreate -L 2G -n lv3 vg0

  Logical volume "lv3" created.

[[email protected] ~]# mkfs.xfs /dev/vg0/lv1

meta-data=/dev/vg0/lv1           isize=256    agcount=4, agsize=131072 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=0        finobt=0

data     =                       bsize=4096   blocks=524288, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=0

log      =internal log           bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

[[email protected] ~]# mkfs.xfs /dev/vg0/lv2

meta-data=/dev/vg0/lv2           isize=256    agcount=4, agsize=131072 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=0        finobt=0

data     =                       bsize=4096   blocks=524288, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=0

log      =internal log           bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

[[email protected] ~]# mkfs.xfs /dev/vg0/lv3

meta-data=/dev/vg0/lv3           isize=256    agcount=4, agsize=131072 blks

         =                       sectsz=512   attr=2, projid32bit=1

         =                       crc=0        finobt=0

data     =                       bsize=4096   blocks=524288, imaxpct=25

         =                       sunit=0      swidth=0 blks

naming   =version 2              bsize=4096   ascii-ci=0 ftype=0

log      =internal log           bsize=4096   blocks=2560, version=2

         =                       sectsz=512   sunit=0 blks, lazy-count=1

realtime =none                   extsz=4096   blocks=0, rtextents=0

 

挂载点必须在下面的目录中:/srv/node

 

 

 

 

修改存储的所属权限为swift:

 

创建ring:

/etc/swift下创建后缀为.builder的ring文件

# swift-ring-builder account.builder create 12 2 1

# swift-ring-builder container.builder create 12 2 1

# swift-ring-builder object.builder create 12 2 1

12:  2的12次幂

2表示副本数

1表示间隔,当ring创建好了以后,如果想要rebalance  1个小时候才能做

 

 

下面开始配置指定每个ring到底如何使用zone:

# swift-ring-builder object.builder add z1-192.168.179.140:6200/z1 100      #/srv/node/z1

# swift-ring-builder object.builder add z1-192.168.179.140:6200/z1 100

# swift-ring-builder object.builder add z2-192.168.179.140:6200/z2 100

# swift-ring-builder account.builder add z1-192.168.179.140:6202/z1 100

# swift-ring-builder account.builder add z2-192.168.179.140:6202/z2 100

# swift-ring-builder container.builder add z1-192.168.179.140:6201/z1 100

# swift-ring-builder container.builder add z2-192.168.179.140:6201/z2 100

100表示权重, 可以不指定即默认

 

分配vnode 到zone中:rebalance

 

swift-ring-builder account.builder rebalance

swift-ring-builder container.builder rebalance

swift-ring-builder object.builder rebalance

 

 

 

 


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Swift学习笔记(9)--闭包发布时间:2022-07-14
下一篇:
Swift学习笔记发布时间:2022-07-14
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap