MySQLFabricはOpenStack Novaと連携可能なので、
選択肢の一つとしてProviderとしてOpenStackを登録してみた。

詳細はこちらの資料を参照下さい。
https://oracleus.activeevents.com/2014/connect/fileDownload/session/CF4F217F7E733EF6066ED14D5CB7371C/CON5636_Kindahl-MySQLFabricElasticityOOW2014.pdf

Provider登録用のコマンド

[admin@Fabric01 ~]$ mysqlfabric help provider register
provider register provider_id username password url  [--tenant=NONE] 
[--provider_type=OPENSTACK] [--default_image=NONE] [--default_flavor=NONE] 
[--extra=NONE] [--synchronous]  
Register a provider.

登録したProviderからサーバーをProvisioning

[admin@Fabric01 ~]$ mysqlfabric help server create
server create provider_id  [--image=NONE] [--flavor=NONE] [--number_machines=1] 
[--availability_zone=NONE] [--key_name=NONE] [--security_groups=NONE] 
[--private_network=NONE] [--public_network=NONE] [--userdata=NONE] [--swap=NONE] 
[--scheduler_hints=NONE] [--meta=NONE] [--datastore=NONE] 
[--datastore_version=NONE] [--size=NONE] [--databases=NONE] [--users=NONE] 
[--configuration=NONE] [--security=NONE] [--skip_store] [--wait_spawning] 
[--synchronous]  
Create a virtual machine instance:

コマンドを利用するにはOpenStackのNova Clientなどをインストールしておく必要があります。

[root@Fabric02 admin]# yum install gcc
読み込んだプラグイン:fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * extras: mirror.vastspace.net

[root@Fabric01 mysql]# yum install python-devel python-pip
読み込んだプラグイン:fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                                                | 3.6 kB  00:00:00     extras                                                                                              | 3.4 kB  00:00:00     rpmforge                                                                                            | 1.9 kB  00:00:00     updates                                                                                             | 3.4 kB  00:00:00     (1/2): extras/7/x86_64/primary_db                                                                   |  43 kB  00:00:00     (2/2): updates/7/x86_64/primary_db                                                                  | 6.1 MB  00:00:04     Determining fastest mirrors
 * base: ftp.nara.wide.ad.jp
 * extras: ftp.nara.wide.ad.jp
 * rpmforge: ftp.kddilabs.jp
 * updates: ftp.nara.wide.ad.jp
パッケージ python-pip は利用できません。
依存性の解決をしています
--> トランザクションの確認を実行しています。
---> パッケージ python-devel.x86_64 0:2.7.5-16.el7 を インストール
--> 依存性解決を終了しました。

[root@Fabric01 mysql]# 

[root@Fabric01 mysql]# curl https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -o - | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10655  100 10655    0     0   4164      0  0:00:02  0:00:02 --:--:--  4163
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-12.0.5.zip
Extracting in /tmp/tmp3TYzVX
Now working in /tmp/tmp3TYzVX/setuptools-12.0.5
Installing Setuptools
...
Finished processing dependencies for setuptools==12.0.5

[root@Fabric01 mysql]# 


[root@Fabric01 mysql]# curl -kL https://raw.github.com/pypa/pip/master/contrib/get-pip.py | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 1567k  100 1567k    0     0   539k      0  0:00:02  0:00:02 --:--:-- 2945k
Collecting pip
  Downloading pip-6.0.7-py2.py3-none-any.whl (1.3MB)
    100% |################################| 1.3MB 282kB/s 
Installing collected packages: pip

Successfully installed pip-6.0.7
[root@Fabric01 mysql]# 

[root@Fabric01 mysql]# pip install python-novaclient
Collecting python-novaclient
  Using cached python_novaclient-2.20.0-py2.py3-none-any.whl
Collecting oslo.utils>=1.0.0 (from python-novaclient)
...
Successfully installed Babel-1.3 PrettyTable-0.7.2 argparse-1.3.0 iso8601-0.1.10 netifaces-0.10.4 oslo.utils-1.2.1 pbr-0.10.7 python-keystoneclient-1.0.0 python-novaclient-2.20.0 requests-2.5.1 simplejson-3.6.5 six-1.9.0

[root@Fabric01 mysql]# 

[root@Fabric01 mysql]# pip install python-neutronclient
Collecting python-neutronclient
  Downloading python_neutronclient-2.3.10-py2.py3-none-any.whl (180kB)
    100% |################################| 184kB 1.7MB/s 
Requirement already satisfied (use --upgrade to upgrade): oslo.utils>=1.0.0 in /usr/lib/python2.7/site-packages (from python-neutronclient)
...
Successfully installed cliff-1.9.0 cmd2-0.6.8 pyparsing-2.0.3 python-neutronclient-2.3.10
[root@Fabric01 mysql]# 

インストールが完了したら、以下のコマンドでOpenStackをProviderとして登録。
※2015年2月現在で確認出来るProviderは,OpenStackのみが登録可能でした。

-bash-4.2$ mysqlfabric provider register my_stack my_user my_password http://8.21.28.222:5000/v2.0/--tenant=my_user_role --provider_type=OPENSTACK
Fabric UUID:  5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1

                                uuid finished success result
------------------------------------ -------- ------- ------
7c9e3185-a664-42c9-94e8-e9179fc0bab8        1       1      1

state success          when                                                   description
----- ------- ------------- -------------------------------------------------------------
    3       2 1422565944.03 Triggered by <mysql.fabric.events.Event object at 0x2e21a10>.
    4       2 1422565944.04                        Executing action (_register_provider).
    5       2  1422565944.1                         Executed action (_register_provider).

listコマンドで登録したProviderを確認

-bash-4.2$ mysqlfabric provider list
Fabric UUID:  5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1

provider_id      type username                                                url tenant default_image default_flavor extra
----------- --------- -------- -------------------------------------------------- ------ ------------- -------------- -----
   my_stack OPENSTACK  my_user http://8.21.28.222:5000/v2.0/--tenant=my_user_role   None          None           None  None


-bash-4.2$ 

問題無く登録出来たので、他にも付加出来る情報を加えて再登録

-bash-4.2$ mysqlfabric provider register mysqlfabric01 my_user my_password http://8.21.28.222:5000/v2.0/ --tenant=my_user_role --provider_type=OPENSTACK --default_image=mysql_img --default_flavor=nova_mysql01
Fabric UUID:  5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1

                                uuid finished success result
------------------------------------ -------- ------- ------
2b66b1a7-fc9c-4d5f-8178-bf865b2ca863        1       1      1

state success          when                                                   description
----- ------- ------------- -------------------------------------------------------------
    3       2 1422566557.81 Triggered by <mysql.fabric.events.Event object at 0x2e21a10>.
    4       2 1422566557.82                        Executing action (_register_provider).
    5       2 1422566557.83                         Executed action (_register_provider).


-bash-4.2$ mysqlfabric provider list
Fabric UUID:  5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1

  provider_id      type username                                                url       tenant default_image default_flavor extra
------------- --------- -------- -------------------------------------------------- ------------ ------------- -------------- -----
mysqlfabric01 OPENSTACK  my_user                      http://8.21.28.222:5000/v2.0/ my_user_role     mysql_img   nova_mysql01  None
     my_stack OPENSTACK  my_user http://8.21.28.222:5000/v2.0/--tenant=my_user_role         None          None           None  None


-bash-4.2$ 

古い方のProvider情報をunregisterコマンドで登録削除

-bash-4.2$ mysqlfabric provider unregister my_stack
Fabric UUID:  5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1

                                uuid finished success result
------------------------------------ -------- ------- ------
bb497878-3a54-4bf4-8cc4-36e5606200fd        1       1      1

state success          when                                                   description
----- ------- ------------- -------------------------------------------------------------
    3       2 1422566754.92 Triggered by <mysql.fabric.events.Event object at 0x2e21a90>.
    4       2 1422566754.92                      Executing action (_unregister_provider).
    5       2 1422566754.95                       Executed action (_unregister_provider).


-bash-4.2$ mysqlfabric provider list
Fabric UUID:  5ca1ab1e-a007-feed-f00d-cab3fe13249e
Time-To-Live: 1

  provider_id      type username                           url       tenant default_image default_flavor extra
------------- --------- -------- ----------------------------- ------------ ------------- -------------- -----
mysqlfabric01 OPENSTACK  my_user http://8.21.28.222:5000/v2.0/ my_user_role     mysql_img   nova_mysql01  None


-bash-4.2$ 

Fab

OpenStack NovaのAPIの登録まではここで完了。
あとは、mysqlfabric server createコマンドでProvisioingしてMySQL Fabric Groupに追加してスケールアウト対応。

参照:http://docs.openstack.org/ja/user-guide/content/install_clients.html

Comments are closed.

Post Navigation