Suggested Horizontal Scaling - Device Strength

Gps man10 months ago

Will traccar connect to read only db or I need to make any code changes???

Anton Tananaev10 months ago

I don't see why not, but let us know how it goes.

Gps man10 months ago
ERROR: Main method error - The MySQL server is running with the --read-only option so it cannot execute this statement - SQLException (... < DatabaseModule:95 < <gener:-1 < *:-1 < ... < Main:128 < ...)

getting above error while starting traccar

Anton Tananaev10 months ago

You have to disable the changelogs.

Gps man10 months ago

i disabled it by commenting this in default.xml

key='database.changelog'>./schema/changelog-master.xml
Gps man10 months ago

but still getting same error in log and traccar service terminates

Gps man10 months ago
2024-02-09 06:26:22  INFO: Starting server...
2024-02-09 06:26:22  INFO: HikariPool-1 - Starting...
2024-02-09 06:26:23  INFO: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@1e7f2e0f
2024-02-09 06:26:23  INFO: HikariPool-1 - Start completed.
2024-02-09 06:26:23 ERROR: Main method error - The MySQL server is running with the --read-only option so it cannot execute this statement - SQLException (... < QueryBuilder:469 < DatabaseStorage:125 < DeviceUtil:30 < ...)
Gps man10 months ago

Anything wrong done at my end ?

Anton Tananaev10 months ago

Now the line numbers don't match. Either you're using an old version or you're using a custom version. I would recommend trying the official latest release.

Gps man10 months ago
ERROR: Main method error - The MySQL server is running with the --read-only option so it cannot execute this statement - SQLException (... < QueryBuilder:469 < DatabaseStorage:125 < DeviceUtil:30 < ...)

I just commented few lines in datastorage to check if changelog statement commented case was not working.

Anton Tananaev10 months ago

It still doesn't match the latest official release. Unfortunately I won't be able to help with this anymore at this point.

Gps man10 months ago

i have taken master branch and then build from the source... anyways will try to get the file from release and then share here

Anton Tananaev10 months ago

This is DeviceUtil line 30 from your stack trace on master branch:

https://github.com/traccar/traccar/blob/master/src/main/java/org/traccar/helper/model/DeviceUtil.java#L30

It does not have any function calls, so it's clearly not the right code.

Gps man10 months ago

Now giving from 5.11 stable build. complete log trace, hope this will help.

2024-02-10 04:46:55 DEBUG: Preloading singletons: 55ms
2024-02-10 04:46:55  INFO: Operating system name: Linux version: 6.2.0-1018-aws architecture: amd64
2024-02-10 04:46:55  INFO: Java runtime name: OpenJDK 64-Bit Server VM vendor: Eclipse Adoptium version: 17.0.6+10
2024-02-10 04:46:55  INFO: Memory limit heap: 20480mb non-heap: 0mb
2024-02-10 04:46:55  INFO: Character encoding: UTF-8 charset: UTF-8
2024-02-10 04:46:55  INFO: Version: 5.11
2024-02-10 04:46:55  INFO: Starting server...
2024-02-10 04:46:55 DEBUG: Driver class com.mysql.cj.jdbc.Driver found in Thread context class loader jdk.internal.loader.ClassLoaders$AppClassLoader@207b8649
2024-02-10 04:46:55 DEBUG: HikariPool-1 - configuration:
2024-02-10 04:46:55 DEBUG: allowPoolSuspension.............false
2024-02-10 04:46:55 DEBUG: autoCommit......................true
2024-02-10 04:46:55 DEBUG: catalog.........................none
2024-02-10 04:46:55 DEBUG: connectionInitSql..............."SELECT 1"
2024-02-10 04:46:55 DEBUG: connectionTestQuery.............none
2024-02-10 04:46:55 DEBUG: connectionTimeout...............30000
2024-02-10 04:46:55 DEBUG: dataSource......................none
2024-02-10 04:46:55 DEBUG: dataSourceClassName.............none
2024-02-10 04:46:55 DEBUG: dataSourceJNDI..................none
2024-02-10 04:46:55 DEBUG: dataSourceProperties............{password=<masked>}
2024-02-10 04:46:55 DEBUG: driverClassName................."com.mysql.cj.jdbc.Driver"
2024-02-10 04:46:55 DEBUG: exceptionOverrideClassName......none
2024-02-10 04:46:55 DEBUG: healthCheckProperties...........{}
2024-02-10 04:46:55 DEBUG: healthCheckRegistry.............none
2024-02-10 04:46:55 DEBUG: idleTimeout.....................600000
2024-02-10 04:46:55 DEBUG: initializationFailTimeout.......1
2024-02-10 04:46:55 DEBUG: isolateInternalQueries..........false
2024-02-10 04:46:55 DEBUG: jdbcUrl.........................jdbc:mysql://masked?zeroDateTimeBehavior=round&serverTimezone=UTC&useSSL=false&allowMultiQueries=true&autoReconnect=true&useUnicode=yes&characterEncoding=UTF-8&sessionVariables=sql_mode=''
2024-02-10 04:46:55 DEBUG: keepaliveTime...................0
2024-02-10 04:46:55 DEBUG: leakDetectionThreshold..........0
2024-02-10 04:46:55 DEBUG: maxLifetime.....................1800000
2024-02-10 04:46:55 DEBUG: maximumPoolSize.................600
2024-02-10 04:46:55 DEBUG: metricRegistry..................none
2024-02-10 04:46:55 DEBUG: metricsTrackerFactory...........none
2024-02-10 04:46:55 DEBUG: minimumIdle.....................600
2024-02-10 04:46:55 DEBUG: password........................<masked>
2024-02-10 04:46:55 DEBUG: poolName........................"HikariPool-1"
2024-02-10 04:46:55 DEBUG: readOnly........................false
2024-02-10 04:46:55 DEBUG: registerMbeans..................false
2024-02-10 04:46:55 DEBUG: scheduledExecutor...............none
2024-02-10 04:46:55 DEBUG: schema..........................none
2024-02-10 04:46:55 DEBUG: threadFactory...................internal
2024-02-10 04:46:55 DEBUG: transactionIsolation............default
2024-02-10 04:46:55 DEBUG: username........................"masked"
2024-02-10 04:46:55 DEBUG: validationTimeout...............5000
2024-02-10 04:46:55  INFO: HikariPool-1 - Starting...
2024-02-10 04:46:55 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-02-10 04:46:55 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-02-10 04:46:55 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-02-10 04:46:55 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-02-10 04:46:55 DEBUG: X509Certificate: Alg:{0}, Serial:{1}, Subject:{2}, Issuer:{3}, Key type:{4}, Length:{5,number,#}, Cert Id:{6,number,#}, Valid from:{7}, Valid until:{8}
2024-02-10 04:46:56  INFO: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@5767b2af
2024-02-10 04:46:56  INFO: HikariPool-1 - Start completed.
2024-02-10 04:46:56 DEBUG: HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@69effba7
2024-02-10 04:46:56 ERROR: Main method error - The MySQL server is running with the --read-only option so it cannot execute this statement - SQLException (... < QueryBuilder:469 < DatabaseStorage:115 < DeviceUtil:39 < ...)
Gps man8 months ago

Finally we deployed a read-replica server. This is working good for report generation and all. However, it appears that there is some additional burden on the primary server as inserts slow down for reason not known... replication is happening in <1s

any idea how this can be optimized or my view on additional burden on the primary server is wrong...........