Thursday, April 9, 2015

Install and Configure Ceph RadosGateway- dumpling version on RHEL 7

This is radosgw lab steps I try. I used virtualbox and setup RHEL7 as guestOS. 

PS: before you start, please make sure you have all the required ceph repo under your /etc/yum.repo.d/


=================================
 Install Ceph Object Gateway
=================================
To run a Ceph Object Storage service, you must install Apache and Ceph Object Gateway daemon on the host that is going to provide the gateway service, i.e, the gateway host. 


install apache
=========================
#sudo yum install httpd

configure apache
=========================
1. Open the httpd.conf file:
#sudo vim /etc/httpd/conf/httpd.conf

2. Uncomment #ServerName in the file and add the name of your server. Provide the fully qualified domain name of the server machine (e.g., hostname -f):
ServerName {fqdn}

ServerName ceph-vm13

3. Edit the line Listen 80 in /etc/httpd/conf/httpd.conf with the public IP address of the host that you are configuring as a gateway server. Write Listen {IP ADDRESS}:80 in place of Listen 80.

Listen localhost:80 

4. Start httpd service
#sudo service httpd start
Or:
#sudo systemctl start http


install ceph 
=========================
#sudo yum install ceph-radosgw

PS:
ceph auth list
make sure keyring name in [] and path is same in ceph.conf

=================================
 Configuring Ceph Object Gateway
=================================

Configuring a Ceph Object Gateway requires a running Ceph Storage Cluster, and an Apache web server with the FastCGI module.

The Ceph Object Gateway is a client of the Ceph Storage Cluster. As a 
Ceph Storage Cluster client, it requires:

Assumy my hostname is ceph-vm13

Create a User and Keyring
=========================

1. Create a keyring for the gateway. ::

#sudo ceph-authtool --create-keyring /etc/ceph/ceph.client.radosgw.keyring
#sudo chmod +r /etc/ceph/ceph.client.radosgw.keyring


2. Generate a Ceph Object Gateway user name and key for each instance. For exemplary purposes, we will use the name ``gateway`` after ``client.radosgw``:: 

#sudo ceph-authtool /etc/ceph/ceph.client.radosgw.keyring -n client.radosgw.gateway --gen-key


3 Add capabilities to the key. See `Configuration Reference - Pools`_ for details on the effect of write permissions for the monitor and creating pools. ::

#sudo ceph-authtool -n client.radosgw.gateway --cap osd 'allow rwx' --cap mon 'allow rwx' /etc/ceph/ceph.client.radosgw.keyring


4. Once you have created a keyring and key to enable the Ceph Object Gateway with access to the Ceph Storage Cluster, add the key to your Ceph Storage Cluster. 
For example::

#sudo ceph -k /etc/ceph/ceph.client.admin.keyring auth add client.radosgw.gateway -i /etc/ceph/ceph.client.radosgw.keyring


5. Distribute the keyring to the node with the gateway instance. ::

#sudo scp /etc/ceph/ceph.client.radosgw.keyring  root@ceph-vm13:/home/cephdeploy
#ssh ceph-vm13
#sudo mv ceph.client.radosgw.keyring /etc/ceph/ceph.client.radosgw.keyring

Create Pools
============

Ceph Object Gateways require Ceph Storage Cluster pools to store specific
gateway data.  If the user you created has permissions, the gateway will create the pools automatically. However, you should ensure that you have
set an appropriate default number of placement groups per pool into your Ceph configuration file.

.. note:: Ceph Object Gateways have multiple pools, so don't make the number of PGs too high considering all of the pools assigned to the same CRUSH hierarchy, or performance may suffer.

if you don't you can use this command to create pool, if you did before when you test osd you can skip here

#ceph osd pool create {poolname} {pg-num} {pgp-num} {replicated | erasure} [{erasure-code-profile}]  {ruleset-name} {ruleset-number}

Double check your pool
#sudo rados lspools


Add a Gateway Configuration to Ceph
===================================

Add the Ceph Object Gateway configuration to your Ceph Configuration file. The Ceph Object Gateway configuration requires you to identify the Ceph Object Gateway instance. Then, you must specify the host name where you installed the Ceph Object Gateway daemon, a keyring (for use with cephx), the socket path for  FastCGI and a log file. For example::  

[client.radosgw.{instance-name}]
host = {host-name}
keyring = /etc/ceph/ceph.client.radosgw.keyring
rgw socket path = /var/run/ceph/ceph.radosgw.{instance-name}.fastcgi.sock
log file = /var/log/radosgw/client.radosgw.{instance-name}.log

The ``[client.radosgw.*]`` portion of the gateway instance identifies this portion of the Ceph configuration file as configuring a Ceph Storage Cluster client where the client type is  a Ceph Object Gateway (i.e., ``radosgw``). The instance name follows. For example:: 

[client.radosgw.gateway]
host = ceph-vm13
keyring = /etc/ceph/ceph.client.radosgw.keyring
rgw socket path = /var/run/ceph/ceph.radosgw.gateway.fastcgi.sock
log file = /var/log/radosgw/client.radosgw.gateway.log

.. note:: The ``host`` must be your machine hostname, not the FQDN. Make sure that the name you use for the FastCGI socket is not the same as the one used for the object gateway, which is ``ceph-client.radosgw. instance-name}.asok`` by default. You must use the same name in your S3 FastCGI file too. See `Add a Ceph Object Gateway Script`_ for details.


Redeploy Ceph Configuration
---------------------------

To use ``ceph-deploy`` to push a new copy of the configuration file to the hosts in your cluster, execute the following::

1 ceph-deploy config push {host-name [host-name]...}

#sudo ceph-deploy --overwrite-conf config pull ceph-vm13

#sudo ceph-deploy --overwrite-conf config push ceph-vm13

Add a Ceph Object Gateway Script
================================

Add a ``s3gw.fcgi`` file (use the same name referenced in the first line of ``rgw.conf``). For Debian/Ubuntu distributions, save the file to the ``/var/www`` directory. For CentOS/RHEL distributions, save the file to the``/var/www/html`` directory. Assuming a cluster named ``ceph`` (default), and the user created in previous steps, the contents of the file should include::

#sudo vim /var/www/html/s3gw.fcgi

#!/bin/sh
exec /usr/bin/radosgw -c /etc/ceph/ceph.conf -n client.radosgw.gateway

Ensure that you apply execute permissions to ``s3gw.fcgi``. ::

#sudo chmod +x /var/www/html/s3gw.fcgi

On some distributions, you must also change the ownership to ``apache``. :: 

#sudo chown apache:apache /var/www/html/s3gw.fcgi

Create Data Directory
=====================
#sudo mkdir -p /var/lib/ceph/radosgw/ceph-radosgw.gateway


Create a Gateway Configuration
==============================

On the host where you installed the Ceph Object Gateway, create an ``rgw.conf`` file. 

For CentOS/RHEL systems, place the
file in the ``/etc/httpd/conf.d`` directory. 

------------------------------
sudo vim /etc/httpd/conf.d/rgw.conf

###add###
FastCgiWrapper off
<VirtualHost *:80>
ServerName ceph-vm13
DocumentRoot /var/www/html

ErrorLog /var/log/httpd/rgw_error.log
CustomLog /var/log/httpd/rgw_access.log combined

# LogLevel debug
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
SetEnv proxy-nokeepalive 1
ProxyPass / fcgi://localhost:9000/
</VirtualHost>
-------------------------------

Adjust Path Ownership/Permissions
=================================
#sudo getenforce
Enforcing
#sudo setenforce 0
#sudo getenforce
Permissive
#sudo chown apache:apache /var/log/httpd
#sudo chown apache:apache /var/run/ceph
#sudo chown apache:apache /etc/httpd/conf.d

Restart Services and Start the Gateway
======================================
On CentOS/RHEL systems, use ``httpd``. For example:: 

#sudo systemctl restart httpd

Start the Gateway
-----------------
On CentOS/RHEL systems, use ``ceph-radosgw``. For example::

#sudo /etc/init.d/ceph-radosgw start

No comments:

Post a Comment