Search code examples
apache-cloudstack

Cloudstack management service not starting - merovingian2 - unable to get a new db connection


My first post here...
I am tryng out CloudStack. My setup is server1 = management server, server 2 = Xen Server

I want to run the Cloudstack management UI on Tomcat. I have followed the instructions on this page. http://docs.cloudstack.apache.org/projects/cloudstack-installation/en/4.11/management-server/index.html

Everything installed (I think), and I see that the database has been created. When I try to start the service with --

cloudstack-setup-management

or even with

service cloudstack-management start

My UI is not working. On UI I get

HTTP ERROR 503
Problem accessing /client/. Reason:

    Service Unavailable

I get an error in the log file -- /var/log/cloudstack/management/management-server.log First indication of issue is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

I cannot figure out where its beign called from, or what parameters its trying to connect to the db. The db is up and running. I can login manually with mysql.

Please advise/ask your questions

2018-05-01 15:25:55,186 INFO  [o.a.c.s.m.m.i.DefaultModuleDefinitionSet] (main:null) (logid:) Loading module context [system] from URL [jar:file:/usr/share/cloudstack-management/lib/cloudstack-4.11.0.0.jar!/META-INF/cloudstack/system/spring-core-system-context-inheritable.xml]
2018-05-01 15:25:55,186 INFO  [o.a.c.s.m.m.i.DefaultModuleDefinitionSet] (main:null) (logid:) Loading module context [system] from URL [jar:file:/usr/share/cloudstack-management/lib/cloudstack-4.11.0.0.jar!/META-INF/cloudstack/system/spring-contrail-system-context-inheritable.xml]
2018-05-01 15:25:55,186 INFO  [o.a.c.s.m.m.i.DefaultModuleDefinitionSet] (main:null) (logid:) Loading module context [system] from URL [jar:file:/usr/share/cloudstack-management/lib/cloudstack-4.11.0.0.jar!/META-INF/cloudstack/bootstrap/spring-bootstrap-context-inheritable.xml]
2018-05-01 15:25:56,427 INFO  [c.c.u.d.T.Transaction] (main:null) (logid:) Is Data Base High Availiability enabled? Ans : false
2018-05-01 15:25:56,515 DEBUG [c.c.u.d.DriverLoader] (main:null) (logid:) Successfully loaded DB driver com.mysql.jdbc.Driver
2018-05-01 15:25:56,519 DEBUG [c.c.u.d.DriverLoader] (main:null) (logid:) DB driver com.mysql.jdbc.Driver was already loaded.
2018-05-01 15:25:56,520 DEBUG [c.c.u.d.DriverLoader] (main:null) (logid:) DB driver com.mysql.jdbc.Driver was already loaded.
2018-05-01 15:26:00,739 ERROR [c.c.u.d.Merovingian2] (main:null) (logid:) Unable to get a new db connection
com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at com.mysql.jdbc.Util.handleNewInstance(Util.java:411)
        at com.mysql.jdbc.Util.getInstance(Util.java:386)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1015)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
        at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:975)

Solution

  • I found the resolution to this after trial and error. The cause if that I had not set the "Storage Tags" on the Primary Storage and the Template/ISO.

    Bit more info for newbies like me.. So for example if you have 1 Primary storage, and 1 CentOS template, then In Cent OS Template, go to the Storage Tags and type in a tag (say for example HDD). Then go to the Primary Storage and in Tags, type in the same tag - HDD.

    This way CloudStack can now match up that the Template can be setup on this Primary storage.

    Imagine you want to offer HDD and SSD storage, create 2 templates, one for HDD and one for SSD. Have 1 Primary Storagem one that has tag HDD and other is SSD. Now the SSD template can deploy to the SSD Dissk, and HDD can deploy to HDD.

    This is my understanding... IF someone knows this is not correct, please add to the thread.