標籤:
記錄,方便查閱。
只做部分解釋
Install and configure the controller node
keystone user-create --name swift --pass swiftkeystone user-role-add --user swift --tenant service --role adminkeystone service-create --name swift --type object-store --description "OpenStack Object Storage"keystone endpoint-create --service-id $(keystone service-list | awk ‘/ object-store / {print $2}‘) --publicurl ‘http://controller:8080/v1/AUTH_%(tenant_id)s‘ --internalurl ‘http://controller:8080/v1/AUTH_%(tenant_id)s‘ --adminurl http://controller:8080 \--region regionOne
yum install openstack-swift-proxy python-swiftclient python-keystone-auth-token python-keystonemiddleware memcached -y
從github擷取設定檔
curl -o /etc/swift/proxy-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/proxy-server.conf-sample
/etc/swift/proxy-server.conf
[DEFAULT]bind_port = 8080user = swiftswift_dir = /etc/swift
[pipeline:main]pipeline = authtoken cache healthcheck keystoneauth proxy-logging proxy-server
[app:proxy-server]allow_account_management = trueaccount_autocreate = true
[filter:keystoneauth]use = egg:swift#keystoneauthoperator_roles = admin,_member_ #使用者管理,以及使用的使用者
[filter:authtoken]paste.filter_factory = keystonemiddleware.auth_token:filter_factoryauth_uri = http://controller:5000/v2.0identity_uri = http://controller:35357admin_tenant_name = serviceadmin_user = swiftadmin_password = swiftdelay_auth_decision = true
[filter:cache]memcache_servers = 127.0.0.1:11211
Install and configure the storage nodes
包含2塊塊裝置,添加2塊硬碟,sdb、sdc
fdisk 分區sdb1、sdc1
yum install xfsprogs rsync
mkfs.xfs /dev/sdb1 #檔案系統推薦xfsmkfs.xfs /dev/sdc1mkdir -p /srv/node/sdb1 #建立掛載點mkdir -p /srv/node/sdc1
/etc/fstab 啟動自動掛載點
/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 2/dev/sdc1 /srv/node/sdc1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 2
mount -a #讀取設定檔並掛載mount /srv/node/sdb1mount /srv/node/sdc1
/etc/rsyncd.conf 同步服務
uid = swiftgid = swiftlog file = /var/log/rsyncd.logpid file = /var/run/rsyncd.pidaddress = 192.168.23.12[account]max connections = 2path = /srv/node/read only = falselock file = /var/lock/account.lock[container]max connections = 2path = /srv/node/read only = falselock file = /var/lock/container.lock[object]max connections = 2path = /srv/node/read only = falselock file = /var/lock/object.lock
yum install openstack-swift-account openstack-swift-container openstack-swift-object -y
擷取account、container、object設定檔:
curl -o /etc/swift/account-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/account-server.conf-samplecurl -o /etc/swift/container-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/container-server.conf-samplecurl -o /etc/swift/object-server.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/object-server.conf-sample
/etc/swift/account-server.conf
[DEFAULT]...bind_ip = 192.168.23.11bind_port = 6002user = swiftswift_dir = /etc/swiftdevices = /srv/node[pipeline:main]pipeline = healthcheck recon account-server
[filter:recon]recon_cache_path = /var/cache/swift
/etc/swift/container-server.conf
[DEFAULT]bind_ip = 192.168.23.11bind_port = 6001user = swiftswift_dir = /etc/swiftdevices = /srv/node
[pipeline:main]pipeline = healthcheck recon container-server
[filter:recon]recon_cache_path = /var/cache/swift
/etc/swift/object-server.conf
[DEFAULT]bind_ip = 192.168.23.11bind_port = 6001user = swiftswift_dir = /etc/swiftdevices = /srv/node
[pipeline:main]pipeline = healthcheck recon container-server
[filter:recon]recon_cache_path = /var/cache/swift
檔案夾許可權:
chown -R swift:swift /srv/nodemkdir -p /var/cache/swiftchown -R swift:swift /var/cache/swift
Create initial ringsController
cd /etc/swift 建立環
swift-ring-builder account.builder create 10 3 1swift-ring-builder account.builder add r1z1-192.168.23.12:6002/sdb1 100 #添加儲存區swift-ring-builder account.builder add r1z1-192.168.23.12:6002/sdc1 100swift-ring-builder account.builder #查看環swift-ring-builder account.builder rebalance #負載平衡環swift-ring-builder container.builder create 10 3 1swift-ring-builder container.builder add r1z1-192.168.23.12:6001/sdb1 100swift-ring-builder container.builder add r1z1-192.168.23.12:6001/sdc1 100swift-ring-builder container.builderswift-ring-builder container.builder rebalanceswift-ring-builder object.builder create 10 3 1swift-ring-builder object.builder add r1z1-192.168.23.12:6000/sdb1 100swift-ring-builder object.builder add r1z1-192.168.23.12:6000/sdc1 100swift-ring-builder object.builderswift-ring-builder object.builder rebalance
Distribute ring configuration files
Copy the account.ring.gz, container.ring.gz, and object.ring.gz files to the /etc/swift directory on each storage node and any additional nodes running the proxy service.
scp -r account.ring.gz container.ring.gz object.ring.gz [email protected]192.168.23.12:/etc/swift/
Finalize installationcontroller
curl -o /etc/swift/swift.conf https://raw.githubusercontent.com/openstack/swift/stable/juno/etc/swift.conf-sample #swift.conf
[swift-hash]swift_hash_path_suffix = yippee #HASH首碼
swift_hash_path_prefix = yippee #HASH尾碼
[storage-policy:0]name = Policy-0default = yes
Copy the swift.conf file to the /etc/swift directory on each storage node and any additional nodes running the proxy service.
scp -r swift.conf object.ring.gz [email protected]192.168.23.12:/etc/swift/
all nodes
檔案夾許可權:
chown -R swift:swift /etc/swift
On the controller node and any other nodes running the proxy service
systemctl enable openstack-swift-proxy.service memcached.servicesystemctl start openstack-swift-proxy.service memcached.service
storage nodes
systemctl enable openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.service systemctl start openstack-swift-account.service openstack-swift-account-auditor.service openstack-swift-account-reaper.service openstack-swift-account-replicator.servicesystemctl enable openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.servicesystemctl start openstack-swift-container.service openstack-swift-container-auditor.service openstack-swift-container-replicator.service openstack-swift-container-updater.servicesystemctl enable openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.servicesystemctl start openstack-swift-object.service openstack-swift-object-auditor.service openstack-swift-object-replicator.service openstack-swift-object-updater.service
重啟時出現無法建立容器問題以及容器不見了的問題,三個服務未啟動,連接埠被佔用;
swift-init all startnetstat –tnlpkill -9 xxx #刪除對應pidswift init all restart
至此,swift安裝完成。
openstack學習(七):swift配置以及使用