在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
接上篇,swift-proxy和swift-store的安装 先说一下服务器分配 swift-proxy和keystone部署在192.168.25.11 swift-store是两台 分别是192.168.25.12和192.168.25.13 (这是测试IP) 先安装代理节点swift-proxy: wget -c http://mirror.neu.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm rpm -ivh epel-release-6-8.noarch.rpm 不要问我以上那个干吗用的 本来它是openstack的有关的包下载的地方,相当于一个镜像地址,但事实是它里面什么也没有但是这个环境还必须得安装,就这么简单粗暴,安装完成后在/etc/yum.repos.d/下会生成两个文件 epel.repo和epel- testing.repo 但实际上epel-testing.repo这个文件并没有什么卵用。vim 到epel.repo文件里注销掉[epel]下的以mirror开头的那一行(#mirror。。。),打开http开头的那一行。然后在命令行执行yum makecache就ok了。 yum install openstack-swift openstack-swift-proxy openstack-swift-account openstack-swift-container openstack-swift-object memcached 安装以上包时会有N 多的依赖性,根据要求一一安装,但是坑爹的是好多需要的依赖性centos6.4里、没、有、然后找了N久找到一个下载地址https://repos.fedorapeople.org/openstack/EOL/openstack-icehouse/epel-6/ 在这个地址里随便下载你需要的包吧!不收费! 以上安装完成后,修改配置文件:/etc/swift/swift.conf [swift-hash] #random unique string that can never change (DO NOT LOSE) swift_hash_path_suffix = `od -t x8 -N 8 -A n < /dev/random` 创建自签名证书 cd /etc/swift openssl req -new -x509 -nodes -out cert.crt -keyout cert.key 配置proxy-server:/etc/swift/proxy-server.conf [DEFAULT] [pipeline:main] [app:proxy-server] [filter:cache] [filter:catch_errors] [filter:healthcheck] [filter:keystone] [filter:authtoken] 创建 account, container, object rings 第二个参数为每个对象复制的个数swift-ring-builder account.builder create 18 1 1 swift-ring-builder container.builder create 18 1 1 swift-ring-builder object.builder create 18 1 1
swift-ring-builder account.builder add z1-192.168.25.12:6002/sdb1 100 (swift-ring-builder account.builder add z2-192.168.25.13:6002/sdb1 100) swift-ring-builder container.builder add z1-192.168.25.12:6001/sdb1 100 swift-ring-builder object.builder add z1-192.168.25.12:6000/sdb1 100
swift-ring-builder account.builder swift-ring-builder container.builder swift-ring-builder object.builder 重新平衡ring swift-ring-builder account.builder rebalance swift-ring-builder container.builder rebalance swift-ring-builder object.builder rebalance 复制所有配置文件为swift用户所有 chown -R swift:swift /etc/swift 启动proxy服务(在存储节点服务启动之后再启动) swift-init proxy start 下面安装存储节点,因为两台存储节点配置一样,所以只以192.168.25.12为例: 同样没有包但是需要环境的epel的配置,雷同swift-proxy的配置 yum install openstack-swift-account openstack-swift-container openstack-swift-object xfsprogs(没有的包自己去https://repos.fedorapeople.org/openstack/EOL/openstack-icehouse/epel-6/这个地址找) 创建虚拟磁盘: fdisk /dev/sdb=》创建虚拟磁盘sdb1 mkfs.xfs -i size=1024 /dev/sdb1 创建文件系统 echo "/dev/sdb1 /srv/node/sdb1 xfs noatime,nodiratime,nobarrier,logbufs=8 0 0" >> /etc/fstab 添加到启动时自动挂载分区 mkdir -p /srv/node/sdb1 mount /dev/sdb1 /srv/node/sdb1 当然也可以执行mount -a 是/etc/fstab 生效 chown -R swift:swift /srv/node 创建/etc/rsyncd.conf (rsync需要yum) uid = swift gid = swift log file = /var/log/rsyncd.log 在开启rsync服务之前需要拷贝swift-proxy中/etc/swift/下的swift.conf object.ring.gz container.ring.gz account.ring.gz 到存储节点的/etc/swift目录下。 rsync --daemon --config=/etc/rsyncd.conf 开启rsync服务 创建三个配置文件: /etc/swift/account-server.conf [DEFAULT] [pipeline:main] [app:account-server] [account-replicator] [account-auditor] [account-reaper] /etc/swift/container-server.conf [DEFAULT] bind_ip = 192.168.25.12 [pipeline:main] [app:container-server] [container-replicator] [container-updater] [container-auditor] [container-sync] /etc/swift/object-server.conf [DEFAULT] bind_ip = 192.168.25.12 [pipeline:main] [app:object-server] [object-replicator] [object-updater] [object-auditor] 开启storage服务 swift-init object-server start swift-init object-replicator start swift-init object-updater start swift-init object-auditor start swift-init container-server start swift-init container-replicator start swift-init container-updater start swift-init container-auditor start swift-init account-server start swift-init account-replicator start swift-init account-auditor start 以上是主节点和存储节点的配置 192.168.25.13的配置与12的配置相同 只是需要把account-server.conf container-server.conf object-server.conf 的ip改为本机ip即可
下面进行测试: 在主节点上:swift -V 2.0 -A http://localhost:35357/v2.0 -U admin:admin -K 123456 stat swift -V 2.0 -A http://localhost:35357/v2.0 -U admin:admin -K 123456 upload myfile token 上传文件到存储节点,在/srv/node/sdb1/objects目录下 swift -V 2.0 -A http://localhost:35357/v2.0 -U admin:admin -K 123456 download myfile token 可从存储节点下载文件 以上整个openstack swift 云存储就部署完成了!
|
请发表评论