スポンサーサイト

  • 2014.12.03 Wednesday

一定期間更新がないため広告を表示しています

  • 0
    • -
    • -
    • -

    CloudStackでusageがDBに格納されてない問題の対処

    • 2014.09.14 Sunday
    • 13:37
    ■環境
    CloudStack 4.3

    CloudStack環境の基本動作に問題が無い所まで構築が進んだ所で、発覚。

    management-server.logを見ていると…
       
    # less  /var/log/cloudstack/management/management-server.log
    2014-09-12 00:02:38,916 INFO  [c.c.h.HighAvailabilityManagerImpl] (HA-1:ctx-43b4e923) checking health of usage server
    2014-09-12 00:02:38,917 DEBUG [c.c.h.HighAvailabilityManagerImpl] (HA-1:ctx-43b4e923) usage server running? false, heartbeat: null
    2014-09-12 00:02:38,917 WARN  [o.a.c.alerts] (HA-1:ctx-43b4e923)  alertType:: 13 // dataCenterId:: 0 // podId:: 0 // clusterId:: null // message:: No usage server process running
       
    ん?
    usage server running? false」で、そのあと「No usage server process running」となっている。

    サービス確認…
    # service cloudstack-usage status
    cloudstack-usage (pid  4103) is running...
    問題なし。

    プロセスは…
    # ps -ef |grep usage
    root      4101     1  0 Sep12 ?        00:00:00 jsvc.exec -cp ::/usr/share/cloudstack-usage/cloud-usage-4.3.0.jar:...(略)
    cloud     4103  4101  0 Sep12 ?        00:01:24 jsvc.exec -cp ::/usr/share/cloudstack-usage/cloud-usage-4.3.0.jar:...(略)
    問題なし。

    DBの方にはちゃんと格納されているのか…?
    mysql> use cloud_usage;
    Reading table information for completion of table and column names
    You can turn off this feature to get a quicker startup with -A

    Database changed
    mysql> select * from cloud_usage;
    Empty set (0.03 sec)
    空…!?

    どうもこんなエラーが。
    # less /var/log/cloudstack/usage/cloudstack-usage.err 
    Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/cloud?autoReconnect=true&prepStmtCacheSize=517&cachePrepStmts=true
            at java.sql.DriverManager.getConnection(DriverManager.java:635)
            at java.sql.DriverManager.getConnection(DriverManager.java:195)
            at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75)
            at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
            at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)
            at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
            at com.cloud.utils.db.TransactionLegacy.getConnection(TransactionLegacy.java:556)
            at com.cloud.utils.db.TransactionLegacy.prepareStatement(TransactionLegacy.java:467)
            at com.cloud.utils.db.TransactionLegacy.prepareAutoCloseStatement(TransactionLegacy.java:460)
            at com.cloud.utils.db.GenericDaoBase.searchIncludingRemoved(GenericDaoBase.java:394)

    そこでこちらを参考にさせて頂いた。ご案内いただいた師匠に感謝!
    参考URL:http://thehyperadvisor.com/2014/06/04/enabling-cloudstack-usage-server-in-4-3/
     
    service cloudstack-usage stop
    ln -s /usr/share/java/mysql-connector-java.jar /usr/share/cloudstack-usage/lib/mysql-connector-java.jar
    service cloudstack-usage start

    1時間置いて…
    # less  /var/log/cloudstack/management/management-server.log
    2014-09-14 00:12:38,916 INFO  [c.c.h.HighAvailabilityManagerImpl] (HA-3:ctx-f8491454) checking health of usage server
    2014-09-14 00:12:38,917 DEBUG [c.c.h.HighAvailabilityManagerImpl] (HA-3:ctx-f8491454) usage server running? true, heartbeat: Sun Sep 14 00:12:29 JST 2014
    usage server running? true」になった。

    Jobが実行される指定時刻まで放置後…
    mysql> select * from cloud_usage;
    +----+---------+------------+-----------+-----------------------------------------------------+---------------+------------+----------------------+----------------+---------+-------------+-------------+----------+-----------+-------------+------------+---------------------+---------------------+--------------+
    | id | zone_id | account_id | domain_id | description                                         | usage_display | usage_type | raw_usage            | vm_instance_id | vm_name | offering_id | template_id | usage_id | type      | size        | network_id | start_date          | end_date            | virtual_size |
    +----+---------+------------+-----------+-----------------------------------------------------+---------------+------------+----------------------+----------------+---------+-------------+-------------+----------+-----------+-------------+------------+---------------------+---------------------+--------------+
    |  1 |       1 |          2 |         1 | testvm allocated (ServiceOffering: 1) (Template: 5) | 0.000278 Hrs  |          2 | 0.000278055580565706 |              3 | testvm  |           1 |           5 |        3 | XenServer |        NULL |       NULL | 2014-08-26 11:08:34 | 2014-08-26 23:59:59 |         NULL |
    |  2 |       1 |          2 |         1 | Volume Id: 3 usage time (DiskOffering: 1)           | 12.857223 Hrs |          6 |     12.8572225570679 |           NULL | NULL    |           1 |        NULL |        3 | NULL      | 21474836480 |       NULL | 2014-08-26 11:08:34 | 2014-08-26 23:59:59 |         NULL |
    おお。ナイス。

    でもデフォルトで動かず、手を加えなければならないって…。
     

    PR

    calendar

    S M T W T F S
         12
    3456789
    10111213141516
    17181920212223
    24252627282930
    << September 2017 >>

    selected entries

    categories

    archives

    recommend

    links

    profile

    search this site.

    others

    mobile

    qrcode

    powered

    無料ブログ作成サービス JUGEM