nxsbi opened a new issue, #10780:
URL: https://github.com/apache/cloudstack/issues/10780

   ### problem
   
   I am currently using CentOS 7 and have 4.19.2 installed. I also have usage 
server running on this server. This has been working fine for long time. I 
added a second management server (on Ubuntu 22). The Management server is up 
and running after a lot of troubleshooting... The main problem was the 
encryptor version. I never upgraded the CentOS7 to V2. Anyhow, I was able to 
get the Management server up and running by using the below:
   
   sudo cloudstack-setup-databases cloud:password@IP_ADDRESS_EXISTING_MYSQL 
--encryptor-version=v1
   
   However the cloudstack-usage service on second server does not come up. 
   It seems to not want to connect to the database??? I have manually validated 
that the user account is valid, the password I used in the setup-databases was 
correct, and I can manually connect to the cloud_usage database from the new 
server using same user/pass. Firewall is open as my management server is 
connecting. 
   
   What am I missing?? I've been stuck on this for a whole day now and not able 
to figure out...
   
   My obfuscated db.properties on the second management server are also listed 
below. 
   
   **For my clarity -- we do run usage server on second management host as well 
right?** 
   
   `**more /var/log/cloudstack/usageusage.log**
   
   
   2025-04-26 20:59:40,150 INFO  [cloud.utils.LogUtils] (main:null) (logid:) 
log4j configuration found at /etc/cloudstack/usage/log4j-cloud.xml
   2025-04-26 20:59:40,998 DEBUG [utils.crypt.EncryptionSecretKeyChecker] 
(main:null) (logid:) Encryption Type: null
   2025-04-26 20:59:41,001 INFO  [db.Transaction.Transaction] (main:null) 
(logid:) Is Data Base High Availiability enabled? Ans : false
   2025-04-26 20:59:41,030 WARN  [db.Transaction.Transaction] (main:null) 
(logid:) Unable to load db configuration, using defaults with 5 connections. 
Falling back o
   n assumed datasource on localhost:3306 using username:password=cloud:cloud. 
Please check your configuration
   java.lang.NumberFormatException: null
           at java.base/java.lang.Integer.parseInt(Integer.java:614)
           at java.base/java.lang.Integer.parseInt(Integer.java:770)
           at 
com.cloud.utils.db.TransactionLegacy.initDataSource(TransactionLegacy.java:1032)
           at 
com.cloud.utils.db.TransactionLegacy.<clinit>(TransactionLegacy.java:1010)
           at 
com.cloud.utils.db.TransactionContextBuilder.interceptStart(TransactionContextBuilder.java:49)
           at 
com.cloud.utils.component.ComponentInstantiationPostProcessor$InterceptorDispatcher.intercept(ComponentInstantiationPostProcessor.java:116)
           at 
com.cloud.usage.dao.UsageVolumeDaoImpl_EnhancerByCloudStack_790f5917.createPartialSelectSql(<generated>)
           at com.cloud.utils.db.GenericDaoBase.<init>(GenericDaoBase.java:241)
           at 
com.cloud.usage.dao.UsageVolumeDaoImpl.<init>(UsageVolumeDaoImpl.java:52)
           at 
com.cloud.usage.dao.UsageVolumeDaoImpl_EnhancerByCloudStack_790f5917.<init>(<generated>)
           at 
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native
 Method)
           at 
java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
           at 
java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
           at 
java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
           at net.sf.cglib.core.ReflectUtils.newInstance(ReflectUtils.java:291)
           at 
net.sf.cglib.proxy.Enhancer$EnhancerFactoryData.newInstance(Enhancer.java:448)
           at net.sf.cglib.proxy.Enhancer.nextInstance(Enhancer.java:700)
           at 
net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:298)
           at net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:480)
           at net.sf.cglib.proxy.Enhancer.create(Enhancer.java:305)
           at 
com.cloud.utils.component.ComponentInstantiationPostProcessor.postProcessBeforeInstantiation(ComponentInstantiationPostProcessor.java:92)
           at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInstantiation(AbstractAutowireCapableBeanFact
   ory.java:1160)
           at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.resolveBeforeInstantiation(AbstractAutowireCapableBeanFactory.java:1135)
           at 
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:531)
           at 
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
           at 
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
           at 
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
           at 
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208)
           at 
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:955)
           at 
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:920)
           at 
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
           at 
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:144)
           at 
org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:85)
           at com.cloud.usage.UsageServer.start(UsageServer.java:52)
           at com.cloud.usage.UsageServer.main(UsageServer.java:41)
   `
   
   `sudo more /etc/cloudstack/management/db.properties
   
   # management server clustering parameters, change cluster.node.IP to the 
machine IP address
   # in which the management server is running
   cluster.node.IP=NEW_MGMT_IP
   cluster.servlet.port=9090
   region.id=1
   
   # CloudStack database settings
   db.cloud.username=cloud
   db.cloud.password=ENC(encrypted password)
   db.cloud.host=EXISTING_DB_IP
   db.cloud.driver=jdbc:mysql
   db.cloud.port=3306
   db.cloud.name=cloud
   
   # Connection URI to the database "cloud". When this property is set, only 
the following properties will be used along with it: db.cloud.maxActive, 
db.cloud.maxIdl
   e, db.cloud.maxWait, db.cloud.username, db.cloud.password, db.cloud.driver, 
db.cloud.validationQuery, db.cloud.isolation.level. Other properties will be 
ignored.
   db.cloud.uri=
   
   
   # CloudStack database tuning parameters
   db.cloud.maxActive=250
   db.cloud.maxIdle=30
   db.cloud.maxWait=10000
   db.cloud.validationQuery=SELECT 1
   db.cloud.testOnBorrow=true
   db.cloud.testWhileIdle=true
   db.cloud.timeBetweenEvictionRunsMillis=40000
   db.cloud.minEvictableIdleTimeMillis=240000
   db.cloud.poolPreparedStatements=false
   
#db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_Z
   ERO,NO_ENGINE_SUBSTITUTION'&serverTimezone=UTC
   
db.cloud.url.params=prepStmtCacheSize=517&cachePrepStmts=true&sessionVariables=sql_mode='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZE
   RO,NO_ENGINE_SUBSTITUTION'&serverTimezone=PST8PDT
   
   
   # CloudStack database SSL settings
   db.cloud.useSSL=false
   db.cloud.keyStore=
   db.cloud.keyStorePassword=
   db.cloud.trustStore=
   db.cloud.trustStorePassword=
   
   # Encryption Settings
   db.cloud.encryption.type=file
   db.cloud.encrypt.secret=ENC(encrypted password)
   db.cloud.encryptor.version=v1
   
   # usage database settings
   db.usage.username=cloud
   db.usage.password=ENC(encrypted password)
   db.usage.host=EXISTING_DB_IP
   db.usage.driver=jdbc:mysql
   db.usage.port=3306
   db.usage.name=cloud_usage
   
   # Connection URI to the database "usage". When this property is set, only 
the following properties will be used along with it: db.usage.maxActive, 
db.cloud.maxIdl
   e, db.cloud.maxWait, db.usage.username, db.usage.password, db.usage.driver, 
db.usage.validationQuery, db.usage.isolation.level. Other properties will be 
ignored.
   db.usage.uri=
   
   
   # usage database tuning parameters
   db.usage.maxActive=100
   db.usage.maxIdle=30
   db.usage.maxWait=10000
   #db.usage.url.params=serverTimezone=UTC
   db.usage.url.params=serverTimezone=PST8PDT
   
   
   # Simulator database settings
   db.simulator.username=cloud
   db.simulator.password=cloud
   db.simulator.host=NEW_MGMT_IP
   db.simulator.driver=jdbc:mysql
   db.simulator.port=3306
   db.simulator.name=simulator
   db.simulator.maxActive=250
   db.simulator.maxIdle=30
   db.simulator.maxWait=10000
   db.simulator.autoReconnect=true
   
   # Connection URI to the database "simulator". When this property is set, 
only the following properties will be used along with it: db.simulator.host, 
db.simulator
   .port, db.simulator.name, db.simulator.autoReconnect. Other properties will 
be ignored.
   db.simulator.uri=
   
   
   # High Availability And Cluster Properties
   db.ha.enabled=false
   db.ha.loadBalanceStrategy=com.cloud.utils.db.StaticStrategy
   # cloud stack Database
   db.cloud.replicas=NEW_MGMT_IP,localhost
   db.cloud.autoReconnect=true
   db.cloud.failOverReadOnly=false
   db.cloud.reconnectAtTxEnd=true
   db.cloud.autoReconnectForPools=true
   db.cloud.secondsBeforeRetrySource=3600
   db.cloud.queriesBeforeRetrySource=5000
   db.cloud.initialTimeout=3600
   
   #usage Database
   db.usage.replicas=NEW_MGMT_IP,localhost
   db.usage.autoReconnect=true
   db.usage.failOverReadOnly=false
   db.usage.reconnectAtTxEnd=true
   db.usage.autoReconnectForPools=true
   db.usage.secondsBeforeRetrySource=3600
   db.usage.queriesBeforeRetrySource=5000
   db.usage.initialTimeout=3600
   `
   
   ### versions
   
   Cloudstack 4.19.2
   2 management server setup
   
   
   ### The steps to reproduce the bug
   
   1. Install a second management server
   2. setup and enable usage server 
   3.
   ...
   
   
   ### What to do about it?
   
   _No response_


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to