Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Openstack O version configures swift object Storage Service

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

The environment is shown in the following figure:

IP:192.168.0.111 controller

IP:192.168.0.112 compute

IP:192.168.0.113 object1

IP:192.168.0.117 object2

IP:192.168.0.118 cinder

1. Install the swift service on the control node

[root@controller ~] # source admin-openrc

Create a swift user

[root@controller] # openstack user create-- domain default-- password-prompt swift

[root@controller] # openstack role add-- project service-- user swift admin

Create a swift service

[root@controller] # openstack service create-- name swift-- description "OpenStack Object Storage" object-store

Create an object storage service API endpoint:

[root@controller ~] # openstack endpoint create-- region RegionOne\

Object-store public http://controller:8080/v1/AUTH_%\(tenant_id\)s

[root@controller ~] # openstack endpoint create-- region RegionOne\

Object-store internal http://controller:8080/v1/AUTH_%\(tenant_id\)s

[root@controller ~] # openstack endpoint create-- region RegionOne\

Object-store admin http://controller:8080/v1

Install the service pack

[root@controller ~] # yum install openstack-swift-proxy python-swiftclient python-keystoneclient python-keystonemiddleware memcached

Copy the proxy-server.conf configuration file to the / etc/swift/ directory

[root@controller swift] # vim / etc/swift/proxy-server.conf

[DEFAULT]

Bind_port = 8080

Swift_dir = / etc/swift

User = swift

[pipeline:main] (remove tempurl and tempauth, add authtoken and keystoneauth modules)

Pipeline = catch_errors gatekeeper healthcheck proxy-logging cache container_sync bulk ratelimit authtoken keystoneauth copy container-quotas account-quotas slo dlo versioned_writes proxy-logging proxy-server

[app:proxy-server]

Use = egg:swift#proxy

Account_autocreate = True

[filter:keystoneauth]

Use = egg:swift#keystoneauth

Operator_roles = admin,user

[filter:authtoken]

Paste.filter_factory = keystonemiddleware.auth_token:filter_factory

Auth_uri = http://controller:5000

Auth_url = http://controller:35357

Memcached_servers = controller:11211

Auth_type = password

Project_domain_id = default

User_domain_id = default

Project_name = service

Username = swift

Password = devops

Delay_auth_decision = True

[filter:cache]

Use = egg:swift#memcache

Memcache_servers = controller:11211

two。 Install and configure the storage node for object1 and object2 respectively, and there are two hard drives on the storage node, sdb and sdc, respectively.

Install the xfsprogs rsync service

[root@object1 ~] # ifconfig | head-2

Ens33: flags=4163 mtu 1500

Inet 192.168.0.113 netmask 255.255.255.0 broadcast 192.168.0.255

[root@object1 ~] # yum-y install xfsprogs rsync

Format sdb and sdc Devic

[root@object1 ~] # mkfs.xfs / dev/sdb

[root@object1 ~] # mkfs.xfs / dev/sdc

Create the mount point directory structure

[root@object1] # mkdir-p / srv/node/sdb

[root@object1] # mkdir-p / srv/node/sdc

Edit the / etc/fstab file and add the following

[root@object1 ~] # cat / etc/fstab | tail-2

/ dev/sdb / srv/node/sdb xfs noatime,nodiratime,nobarrier,logbufs=8 0 2

/ dev/sdc / srv/node/sdc xfs noatime,nodiratime,nobarrier,logbufs=8 0 2

Mounting equipment

[root@object1 ~] # mount / srv/node/sdb/

[root@object1 ~] # mount / srv/node/sdc

[root@object1 ~] # vim / etc/rsyncd.conf

Uid = swift

Gid = swift

Log file = / var/log/rsyncd.log

Pid file = / var/run/rsyncd.pid

Address = 192.168.0.113

[account]

Max connections = 2

Path = / srv/node/

Read only = False

Lock file = / var/lock/account.lock

[container]

Max connections = 2

Path = / srv/node/

Read only = False

Lock file = / var/lock/container.lock

[object]

Max connections = 2

Path = / srv/node/

Read only = False

Lock file = / var/lock/object.lock

Start the rsyncd service

[root@object1 ~] # systemctl enable rsyncd.service

[root@object1 ~] # systemctl start rsyncd.service

[root@object1 ~] # systemctl status rsyncd.service

Install and configure components

[root@object1 ~] # yum install openstack-swift-account openstack-swift-container openstack-swift-object

[root@object1] # curl-o / etc/swift/account-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/account-server.conf-sample?h=stable/newton

[root@object1] # curl-o / etc/swift/container-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/container-server.conf-sample?h=stable/newton

[root@object1] # curl-o / etc/swift/object-server.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/object-server.conf-sample?h=stable/newton

[root@object1 ~] # vim / etc/swift/account-server.conf

[DEFAULT]

Bind_ip = 192.168.0.113

Bind_port = 6202

User = swift

Swift_dir = / etc/swift

Devices = / srv/node

Mount_check = true

[pipeline:main]

Pipeline = healthcheck recon account-server

[filter:recon]

Use = egg:swift#recon

Recon_cache_path = / var/cache/swift

[root@object1 ~] # vim / etc/swift/container-server.conf

[DEFAULT]

Bind_ip = 192.168.0.113

Bind_port = 6201

User = swift

Swift_dir = / etc/swift

Devices = / srv/node

Mount_check = true

[pipeline:main]

Pipeline = healthcheck recon container-server

[filter:recon]

Use = egg:swift#recon

Recon_cache_path = / var/cache/swift

[root@object1 ~] # vim / etc/swift/object-server.conf

[DEFAULT]

Bind_ip = 192.168.0.113

Bind_port = 6200

User = swift

Swift_dir = / etc/swift

Devices = / srv/node

Mount_check = true

[pipeline:main]

Pipeline = healthcheck recon object-server

[filter:recon]

Use = egg:swift#recon

Recon_cache_path = / var/cache/swift

Recon_lockpath = / var/lock

[root@object1] # chown-R swift:swift / srv/node

[root@object1] # chown-R root:swift / var/cache/swift/

[root@object1] # chmod-R 755 / var/cache/swift/

Similarly, do the same on object2, and modify the IP of the IP address in the configuration file.

[root@object2 ~] # systemctl enable rsyncd.service

[root@object2 ~] # systemctl start rsyncd.service

[root@object2 ~] # systemctl status rsyncd.service

3. Create and distribute the initial ring perform the following steps on the control node

Create an account

Change to the / etc/swift directory

[root@controller ~] # cd / etc/swift/

[root@controller swift] # swift-ring-builder account.builder create 10 3 1

Add Storage Node

[root@controller swift] # swift-ring-builder account.builder add-region 1-zone 1-ip 192.168.0.113-port 6202-device sdb-weight 100

Device d0r1z1-192.168.0.113:6202R192.168.0.113:6202/sdb "" with 100.0 weight got id 0

You have mail in / var/spool/mail/root

[root@controller swift] # swift-ring-builder account.builder add-region 1-zone 1-ip 192.168.0.113-port 6202-device sdc-weight 100

Device d1r1z1-192.168.0.113:6202R192.168.0.113:6202/sdc "" with 100.0 weight got id 1

[root@controller swift] # swift-ring-builder account.builder add-region 1-zone 2-ip 192.168.0.117-port 6202-device sdb-weight 100

Device d2r1z2-192.168.0.117:6202R192.168.0.117:6202/sdb "" with 100.0 weight got id 2

[root@controller swift] # swift-ring-builder account.builder add-region 1-zone 2-ip 192.168.0.117-port 6202-device sdc-weight 100

Device d3r1z2-192.168.0.117 with 6202R192.168.0.117 weight got id 6202R192.168.0.117

[root@controller swift] # swift-ring-builder account.builder

Account.builder, build version 4

1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion

The minimum number of hours before a partition can be reassigned is 1 (0:00:00 remaining)

The overload factor is 0.005% (0.000000)

Ring file account.ring.gz not found, probably it hasn't been written yet

Devices: id region zone ip address:port replication ip:port name weight partitions balance flags meta

0 11 192.168.0.113 sdb 6202 192.168.0.113 sdb 100.00 0-100.00

11 1 192.168.0.113 sdc 6202 192.168.0.113 6202 0-100.00

2 1 2 192.168.0.117 sdb 6202 192.168.0.117 sdb 100.00 0-100.00

3 1 2 192.168.0.117 sdc 6202 192.168.0.117 sdc 100.00 0-100.00

[root@controller swift] # swift-ring-builder account.builder rebalance

Reassigned 3072 (300.005%) partitions. Balance is now 0.00. Dispersion is now 0.00

[root@controller swift] # swift-ring-builder container.builder create 10 3 1

[root@controller swift] # swift-ring-builder container.builder add-region 1-zone 1-ip 192.168.0.113-port 6201-device sdb-weight 100

Device d0r1z1-192.168.0.113:6201R192.168.0.113:6201/sdb "" with 100.0 weight got id 0

[root@controller swift] # swift-ring-builder container.builder add-region 1-zone 1-ip 192.168.0.113-port 6201-device sdc-weight 100

Device d1r1z1-192.168.0.113:6201R192.168.0.113:6201/sdc "" with 100.0 weight got id 1

[root@controller swift] # swift-ring-builder container.builder add-region 1-zone 2-ip 192.168.0.117-port 6201-device sdb-weight 100

Device d2r1z2-192.168.0.117:6201R192.168.0.117:6201/sdb "" with 100.0 weight got id 2

[root@controller swift] # swift-ring-builder container.builder add-region 1-zone 2-ip 192.168.0.117-port 6201-device sdc-weight 100

Device d3r1z2-192.168.0.117:6201R192.168.0.117:6201/sdc "" with 100.0 weight got id 3

[root@controller swift] # swift-ring-builder container.builder

Container.builder, build version 4

1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion

The minimum number of hours before a partition can be reassigned is 1 (0:00:00 remaining)

The overload factor is 0.005% (0.000000)

Ring file container.ring.gz not found, probably it hasn't been written yet

Devices: id region zone ip address:port replication ip:port name weight partitions balance flags meta

01 1 192.168.0.113 sdb 6201 192.168.0.113 Freud 100.00 0-100.00

11 1 192.168.0.113 sdc 6201 192.168.0.113 6201 0-100.00

2 1 2 192.168.0.117 sdb 6201 192.168.0.117 6201 0-100.00

3 1 2 192.168.0.117 sdc 6201 192.168.0.117purl 6201 0-100.00

[root@controller swift] # swift-ring-builder container.builder rebalance

Reassigned 3072 (300.005%) partitions. Balance is now 0.00. Dispersion is now 0.00

[root@controller swift] # swift-ring-builder object.builder create 10 3 1

[root@controller swift] # swift-ring-builder object.builder add-region 1-zone 1-ip 192.168.0.113-port 6200-device sdb-weight 100

Device d0r1z1-192.168.0.113:6200R192.168.0.113:6200/sdb "" with 100.0 weight got id 0

[root@controller swift] # swift-ring-builder object.builder add-region 1-zone 1-ip 192.168.0.113-port 6200-device sdc-weight 100

Device d1r1z1-192.168.0.113:6200R192.168.0.113:6200/sdc "" with 100.0 weight got id 1

[root@controller swift] # swift-ring-builder object.builder add-region 1-zone 2-ip 192.168.0.117-port 6200-device sdb-weight 100

Device d2r1z2-192.168.0.117:6200R192.168.0.117:6200/sdb "" with 100.0 weight got id 2

[root@controller swift] # swift-ring-builder object.builder add-region 1-zone 2-ip 192.168.0.117-port 6200-device sdc-weight 100

Device d3r1z2-192.168.0.117:6200R192.168.0.117:6200/sdc "" with 100.0 weight got id 3

[root@controller swift] # swift-ring-builder object.builder

Object.builder, build version 4

1024 partitions, 3.000000 replicas, 1 regions, 2 zones, 4 devices, 100.00 balance, 0.00 dispersion

The minimum number of hours before a partition can be reassigned is 1 (0:00:00 remaining)

The overload factor is 0.005% (0.000000)

Ring file object.ring.gz not found, probably it hasn't been written yet

Devices: id region zone ip address:port replication ip:port name weight partitions balance flags meta

0 11 192.168.0.113 sdb 6200 192.168.0.113 sdb 6200 0-100.00

11 1 192.168.0.113 sdc 6200 192.168.0.113 sdc 6200 0-100.00

2 1 2 192.168.0.117 sdb 6200 192.168.0.117 sdb 6200 0-100.00

3 1 2 192.168.0.117 sdc 6200 192.168.0.117 sdc 100.00 0-100.00

[root@controller swift] # swift-ring-builder object.builder rebalance

Reassigned 3072 (300.005%) partitions. Balance is now 0.00. Dispersion is now 0.00

Download account.ring.gz container.ring.gz object.ring.gz under the / etc/swift directory in controller and put it on each storage node under the / etc/swift/ directory

4. Download and configure swift.conf configuration files on the controller control node

[root@controller swift] # curl-o / etc/swift/swift.conf https://git.openstack.org/cgit/openstack/swift/plain/etc/swift.conf-sample?h=stable/newton

[root@controller swift] # vim / etc/swift/swift.conf

[swift-hash]

Swift_hash_path_suffix = openstack

Swift_hash_path_prefix = openstack

[storage-policy:0]

Name = Policy-0

Default = yes

Download the swift.conf configuration file to each storage node

Process is omitted.

[root@controller swift] # chown-R root:swift / etc/swift/

[root@controller swift] # systemctl enable openstack-swift-proxy.service memcached.service

[root@controller swift] # systemctl start openstack-swift-proxy.service memcached.service

[root@controller swift] # systemctl status openstack-swift-proxy.service memcached.service

5. Start the swift service on the storage node

[root@object1 swift] # systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service

[root@object1 swift] # systemctl start openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service

[root@object1 swift] # systemctl status openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service

[root@object1 swift] # systemctl enable openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service

[root@object1 swift] # systemctl start openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service

[root@object1 swift] # systemctl status openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.service

[root@object1 swift] # systemctl enable openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service

[root@object1 swift] # systemctl start openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service

[root@object1 swift] # systemctl status openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service

5. Verification

Operate on the controller master node

[root@controller ~] # cat demo-openrc

Export OS_USER_DOMAIN_ID=default

Export OS_PROJECT_DOMAIN_ID=default

Export OS_USERNAME=demo

Export OS_PROJECT_NAME=demo

Export OS_PASSWORD=devops

Export OS_IDENTITY_API_VERSION=3

Export OS_IMAGE_API_VERSION=2

Export OS_AUTH_URL= http://controller:5000/v3

[root@controller ~] # source / root/demo-openrc

Show service status

[root@controller ~] # swift stat

Create a container1 container

[root@controller ~] # openstack container create container1

Upload the test file to the container1 container:

[root@controller ~] # openstack object create container1 admin-openrc

[root@controller ~] # openstack objecct list container1

[root@controller ~] # openstack object save container1 admin-openrc

All the configuration files are in Baidu Cloud disk:

Link: https://pan.baidu.com/s/1CnmKkFMTemv199ctgb5Oig

Extraction code: 27om

After copying this content, open the Baidu network disk mobile phone App, which is more convenient to operate.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report