这篇文章将为大家详细讲解有关ceph radosgw如何实现一键安装脚本,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
在ubuntu12.04.5 bit环境下,经常配置radosgw,所以写了个脚本搞定radosgw一键安装,不含ssl的配置,需要的自己添加一下。ceph0.80.x测试通过。
<!-- lang: shell -->
#!/bin/bash
wget -q -O- https://raw.github.com/ceph/ceph/master/keys/autobuild.asc | sudo apt-key add -
echo deb http://gitbuilder.ceph.com/apache2-deb-$(lsb_release -sc)-x86_64-basic/ref/master $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph-apache.list
echo deb http://gitbuilder.ceph.com/libapache-mod-fastcgi-deb-$(lsb_release -sc)-x86_64-basic/ref/master $(lsb_release -sc) main | sudo tee /etc/apt/sources.list.d/ceph-fastcgi.list
HOSTNAME=`hostname`
apt-get install apache2 libapache2-mod-fastcgi radosgw -y
ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
cd /etc/ceph/
chmod +r ceph.client.radosgw.$HOATNAME.keyring
ceph-authtool /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring -n client.radosgw.$HOSTNAME --gen-key
ceph-authtool -n client.radosgw.$HOSTNAME --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.radosgw.$HOSTNAME -i /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
echo -n "
[client.radosgw.$HOSTNAME]
host = $HOSTNAME
keyring = /etc/ceph/ceph.client.radosgw.$HOSTNAME.keyring
rgw socket path = /tmp/radosgw.sock
log file = /var/log/ceph/radosgw.$HOSTNAME.log
rgw dns name = $HOSTNAME
" >> /etc/ceph/ceph.conf
echo -n "#!/bin/sh
exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n client.radosgw.$HOSTNAME" > /var/www/s3gw.fcgi
chmod +x /var/www/s3gw.fcgi
echo -n "FastCgiExternalServer /var/www/s3gw.fcgi -socket /tmp/radosgw.sock
<VirtualHost *:80>
ServerName $HOSTNAME
DocumentRoot /var/www
RewriteEngine On
RewriteRule ^/(.*) /s3gw.fcgi?%{QUERY_STRING} [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
<IfModule mod_fastcgi.c>
<Directory /var/www>
Options +ExecCGI
AllowOverride All
SetHandler fastcgi-script
Order allow,deny
Allow from all
AuthBasicAuthoritative Off
</Directory>
</IfModule>
AllowEncodedSlashes On
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
ServerSignature Off
</VirtualHost>
" > /etc/apache2/sites-available/rgw.conf
echo "ServerName $HOSTNAME" >> /etc/apache2/apache2.conf
sudo a2enmod rewrite
sudo a2enmod fastcgi
a2ensite rgw.conf
a2dissite default
service ceph restart
service apache2 restart
/etc/init.d/radosgw start
关于“ceph radosgw如何实现一键安装脚本”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。