8. 设置rsync
- sudo touch /etc/rsyncd.conf #在/etc/下创建rsyncd.conf
- sudo chmod a+w /etc/rsyncd.conf
- 将以下配置信息写入/etc/rsyncd.conf中
- uid =swift
- gid =swift
- logfile = /var/log/rsyncd.log
- pidfile = /var/run/rsyncd.pid
- address= 127.0.0.1
- [account6012]
- maxconnections = 25
- path =/srv/1/node/
- readonly = false
- lockfile = /var/lock/account6012.lock
- [account6022]
- maxconnections = 25
- path =/srv/2/node/
- readonly = false
- lockfile = /var/lock/account6022.lock
- [account6032]
- maxconnections = 25
- path =/srv/3/node/
- readonly = false
- lockfile = /var/lock/account6032.lock
- [account6042]
- maxconnections = 25
- path =/srv/4/node/
- readonly = false
- lockfile = /var/lock/account6042.lock
- [container6011]
- maxconnections = 25
- path =/srv/1/node/
- readonly = false
- lockfile = /var/lock/container6011.lock
- [container6021]
- maxconnections = 25
- path =/srv/2/node/
- readonly = false
- lockfile = /var/lock/container6021.lock
- [container6031]
- maxconnections = 25
- path =/srv/3/node/
- readonly = false
- lockfile = /var/lock/container6031.lock
- [container6041]
- maxconnections = 25
- path =/srv/4/node/
- readonly = false
- lockfile = /var/lock/container6041.lock
- [object6010]
- maxconnections = 25
- path =/srv/1/node/
- readonly = false
- lockfile = /var/lock/object6010.lock
- [object6020]
- maxconnections = 25
- path =/srv/2/node/
- readonly = false
- lockfile = /var/lock/object6020.lock
- [object6030]
- maxconnections = 25
- path =/srv/3/node/
- readonly = false
- lockfile = /var/lock/object6030.lock
- [object6040]
- maxconnections = 25
- path =/srv/4/node/
- readonly = false
- lockfile = /var/lock/object6040.lock
- 编辑/etc/default/rsync:
- 将RSYNC_ENABLE设置为true
- 重启服务:
- sudo servicersync restart
9. 设置日志文件(可选)
- sudo touch /etc/rsyslog.d/10-swift.conf
- sudo chmod a+w /etc/rsyslog.d/10-swift.conf
- 在该文件中添加如下配置信息
- #Uncomment the following to have a log containing all logs together
- #local1,local2,local3,local4,local5.* /var/log/swift/all.log
- #Uncomment the following to have hourly proxy logs for stats processing
- #$templateHourlyProxyLog,"/var/log/swift/hourly/%$YEAR%%$MONTH%%$DAY%%$HOUR%"
- #local1.*;local1.!notice?HourlyProxyLog
- local1.*;local1.!notice/var/log/swift/proxy.log
- local1.notice /var/log/swift/proxy.error
- local1.* ~
- local2.*;local2.!notice/var/log/swift/storage1.log
- local2.notice /var/log/swift/storage1.error
- local2.* ~
- local3.*;local3.!notice/var/log/swift/storage2.log
- local3.notice /var/log/swift/storage2.error
- local3.* ~
- local4.*;local4.!notice/var/log/swift/storage3.log
- local4.notice /var/log/swift/storage3.error
- local4.* ~
- local5.*;local5.!notice/var/log/swift/storage4.log
- local5.notice /var/log/swift/storage4.error
- local5.*
- 修改/etc/rsyslog.conf:
- 将$PrivDropToGroup syslog改为$PrivDropToGroup adm
- 执行如下命令
- sudo mkdir -p /var/log/swift/hourly
- sudo chown -R syslog.adm /var/log/swift
- sudo service rsyslog restart
10. 配置各个节点(以下文件不存在的话需要自己创建)
sudo chmod a+w -R /etc/swift/*
- 1. /etc/swift/proxy-server.conf
- [DEFAULT]
- bind_port= 8080
- user =swift
- log_facility= LOG_LOCAL1
- [pipeline:main]
- pipeline= healthcheck cache swauth proxy-server
- [app:proxy-server]
- use =egg:swift#proxy
- allow_account_management= true
- account_autocreate= true
- [filter:swauth]
- use =egg:swauth#swauth
- #Highly recommended to change this.
- super_admin_key= swauthkey
- default_swift_cluster= local#http://127.0.0.1:8080/auth/v1.0
- [filter:healthcheck]
- use =egg:swift#healthcheck
- [filter:cache]
- use =egg:swift#memcache
- 2. /etc/swift/swift.conf
- [swift-hash]
- #random unique string that can never change (DO NOT LOSE)
- swift_hash_path_suffix= cynric #cynric是可以随意更改的字符串
- 3. /etc/swift/account-server/1.conf
- [DEFAULT]
- devices= /srv/1/node
- mount_check= false
- bind_port= 6012
- user =swift
- log_facility= LOG_LOCAL2
- [pipeline:main]
- pipeline= account-server
- [app:account-server]
- use =egg:swift#account
- [account-replicator]
- vm_test_mode= yes
- [account-auditor]
- [account-reaper]
- 4. /etc/swift/account-server/2.conf
- [DEFAULT]
- devices= /srv/2/node
- mount_check= false
- bind_port= 6022
- user =swift
- log_facility= LOG_LOCAL3
- [pipeline:main]
- pipeline= account-server
- [app:account-server]
- use =egg:swift#account
- [account-replicator]
- vm_test_mode= yes
- [account-auditor]
- [account-reaper]
- 5. /etc/swift/account-server/3.conf
- [DEFAULT]
- devices= /srv/3/node
- mount_check= false
- bind_port= 6032
- user =swift
- log_facility= LOG_LOCAL4
- [pipeline:main]
- pipeline= account-server
- [app:account-server]
- use =egg:swift#account
- [account-replicator]
- vm_test_mode= yes
- [account-auditor]
- [account-reaper]
- 6. /etc/swift/account-server/4.conf
- [DEFAULT]
- devices= /srv/4/node
- mount_check= false
- bind_port= 6042
- user =swift
- log_facility= LOG_LOCAL5
- [pipeline:main]
- pipeline= account-server
- [app:account-server]
- use =egg:swift#account
- [account-replicator]
- vm_test_mode= yes
- [account-auditor]
- [account-reaper]
- 7. /etc/swift/container-server/1.conf
- [DEFAULT]
- devices= /srv/1/node
- mount_check= false
- bind_port= 6011
- user =swift
- log_facility= LOG_LOCAL2
- [pipeline:main]
- pipeline= container-server
- [app:container-server]
- use =egg:swift#container
- [container-replicator]
- vm_test_mode= yes
- [container-updater]
- [container-auditor]
- [container-sync]
- 8. /etc/swift/container-server/2.conf
- [DEFAULT]
- devices= /srv/2/node
- mount_check= false
- bind_port= 6021
- user =swift
- log_facility= LOG_LOCAL3
- [pipeline:main]
- pipeline= container-server
- [app:container-server]
- use =egg:swift#container
- [container-replicator]
- vm_test_mode= yes
- [container-updater]
- [container-auditor]
- [container-sync]
- 9. /etc/swift/container-server/3.conf
- [DEFAULT]
- devices= /srv/3/node
- mount_check= false
- bind_port= 6031
- user =swift
- log_facility= LOG_LOCAL4
- [pipeline:main]
- pipeline= container-server
- [app:container-server]
- use =egg:swift#container
- [container-replicator]
- vm_test_mode= yes
- [container-updater]
- [container-auditor]
- [container-sync]
- 10./etc/swift/container-server/4.conf
- [DEFAULT]
- devices= /srv/4/node
- mount_check= false
- bind_port= 6041
- user =swift
- log_facility= LOG_LOCAL5
- [pipeline:main]
- pipeline= container-server
- [app:container-server]
- use =egg:swift#container
- [container-replicator]
- vm_test_mode= yes
- [container-updater]
- [container-auditor]
- [container-sync]
- 11./etc/swift/object-server/1.conf
- [DEFAULT]
- devices= /srv/1/node
- mount_check= false
- bind_port= 6010
- user =swift
- log_facility= LOG_LOCAL2
- [pipeline:main]
- pipeline= object-server
- [app:object-server]
- use =egg:swift#object
- [object-replicator]
- vm_test_mode= yes
- [object-updater]
- [object-auditor]
- 12./etc/swift/object-server/2.conf
- [DEFAULT]
- devices= /srv/2/node
- mount_check= false
- bind_port= 6020
- user =swift
- log_facility= LOG_LOCAL3
- [pipeline:main]
- pipeline= object-server
- [app:object-server]
- use =egg:swift#object
- [object-replicator]
- vm_test_mode= yes
- [object-updater]
- [object-auditor]
- 13./etc/swift/object-server/3.conf
- [DEFAULT]
- devices= /srv/3/node
- mount_check= false
- bind_port= 6030
- user =swift
- log_facility= LOG_LOCAL4
- [pipeline:main]
- pipeline= object-server
- [app:object-server]
- use =egg:swift#object
- [object-replicator]
- vm_test_mode= yes
- [object-updater]
- [object-auditor]
- 14./etc/swift/object-server/4.conf
- [DEFAULT]
- devices= /srv/4/node
- mount_check= false
- bind_port= 6040
- user =swift
- log_facility= LOG_LOCAL5
- [pipeline:main]
- pipeline= object-server
- [app:object-server]
- use =egg:swift#object
- [object-replicator]
- vm_test_mode= yes
- [object-updater]
- [object-auditor]
