遵循此安装指南:
https://docs.cloudstack.apache.org/projects/cloudstack-installation/en/latest/qig.html
运行安装命令时:
# yum -y install cloudstack-management
出现无法找到 ULR 404 错误。是官方文件坏了吗?
添加
从日志中我看到:
...
com.cloud.utils.exception.CloudRuntimeException: No database selected for the transaction
2017-04-21 05:28:10,385 ERROR [c.c.c.ClusterManagerImpl] (Cluster-Heartbeat-1:ctx-a3d78589) (logid:c556482a) Unexpected exception in cluster heartbeat
java.lang.RuntimeException: No database selected for the transaction
Caused by: com.cloud.utils.exception.CloudRuntimeException: No database selected for the transaction
2017-04-21 05:28:11,884 WARN [c.c.c.d.ManagementServerHostDaoImpl] (Cluster-Heartbeat-1:ctx-69287ea3) (logid:ee11e3ed) Unexpected exception,
com.cloud.utils.exception.CloudRuntimeException: No database selected for the transaction
2017-04-21 05:28:11,885 ERROR [c.c.c.ClusterManagerImpl] (Cluster-Heartbeat-1:ctx-69287ea3) (logid:ee11e3ed) Unexpected exception in cluster heartbeat
java.lang.RuntimeException: No database selected for the transaction
Caused by: com.cloud.utils.exception.CloudRuntimeException: No database selected for the transaction
2017-04-21 05:28:12,784 ERROR [c.c.u.d.ConnectionConcierge] (ConnectionConcierge-1:ctx-c609b238) (logid:80cc65b8) Unable to keep the db connection for LockMaster1
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1116)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3520)
Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost.
2017-04-21 07:24:23,824 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 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.cloud.utils.db.TransactionLegacy.getStandaloneConnectionWithException(TransactionLegacy.java:212)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Caused by: java.net.NoRouteToHostException: No route to host (Host unreachable)
2017-04-21 07:24:23,862 WARN [o.a.c.s.m.c.ResourceApplicationContext] (main:null) (logid:) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lockMasterListener' defined in URL [jar:file:/usr/share/cloudstack-management/webapps/client/WEB-INF/lib/cloud-server-4.9.2.0.jar!/META-INF/cloudstack/system/spring-server-system-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.cloud.server.LockMasterListener]: Constructor threw exception; nested exception is com.cloud.utils.exception.CloudRuntimeException: Unable to initialize a connection to the database for locking purposes
2017-04-24 01:19:18,333 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 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.cloud.utils.db.TransactionLegacy.getStandaloneConnectionWithException(TransactionLegacy.java:212)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Caused by: java.net.SocketException: Network is unreachable (connect failed)
2017-04-24 01:19:18,387 WARN [o.a.c.s.m.c.ResourceApplicationContext] (main:null) (logid:) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lockMasterListener' defined in URL [jar:file:/usr/share/cloudstack-management/webapps/client/WEB-INF/lib/cloud-server-4.9.2.0.jar!/META-INF/cloudstack/system/spring-server-system-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.cloud.server.LockMasterListener]: Constructor threw exception; nested exception is com.cloud.utils.exception.CloudRuntimeException: Unable to initialize a connection to the database for locking purposes
2017-04-24 01:47:42,075 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 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1013)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:987)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:982)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:927)
at com.cloud.utils.db.TransactionLegacy.getStandaloneConnectionWithException(TransactionLegacy.java:212)
Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
Caused by: java.net.NoRouteToHostException: No route to host (Host unreachable)
2017-04-24 01:47:42,111 WARN [o.a.c.s.m.c.ResourceApplicationContext] (main:null) (logid:) Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'lockMasterListener' defined in URL [jar:file:/usr/share/cloudstack-management/webapps/client/WEB-INF/lib/cloud-server-4.9.2.0.jar!/META-INF/cloudstack/system/spring-server-system-context.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.cloud.server.LockMasterListener]: Constructor threw exception; nested exception is com.cloud.utils.exception.CloudRuntimeException: Unable to initialize a connection to the database for locking purposes
数据库连接异常。如何正确设置数据库?我只是按照那个指南操作,但不知道其他任何事情。
答案1
尝试安装4.8版本:
http://docs.cloudstack.apache.org/projects/cloudstack-installation/en/4.8/qig.html
首先安装数据库:
# yum -y install mysql-server
# service mysqld start
# chkconfig mysqld on
然后安装Cloudstack:
# yum -y install cloudstack-management
# cloudstack-setup-databases cloud:password@localhost --deploy-as=root
# cloudstack-setup-management
此后,您应该在 xxxx:8080/client 上获得管理用户界面,其中 xxxx 是服务器的 ip。