LINBIT / linstor-server

High Performance Software-Defined Block Storage for container, cloud and virtualisation. Fully integrated with Docker, Kubernetes, Openstack, Proxmox etc.
https://docs.linbit.com/docs/linstor-guide/
GNU General Public License v3.0
984 stars 76 forks source link

Bug: Controller fails to init with MySQL #376

Closed tetra12 closed 3 months ago

tetra12 commented 1 year ago

Error: Failed to set transaction isolation

Related to #15

My Setup: Remote MySQL: v8.0.35 Controller: v1.25.0

Can connect to the mysql server with: mysql -h mysql -u linstor -p from the linstor controller host

cat /etc/linstor/linstor.toml
[db]
  user = "linstor"
  password = "foo-foo"
  connection_url = "jdbc:mysql://mysql/linstor?createDatabaseIfNotExist=true"
  #connection_url = "jdbc:mysql://mysql:3306/linstor" // doesn't work either
tetra12 commented 1 year ago
Application:                        LINBIT® LINSTOR
Module:                             Controller
Version:                            1.25.0
Build ID:                           ac6be8b59c99ae4157b4368df646cf530444d70f
Build time:                         2023-10-25T04:33:26+00:00
Error time:                         2023-11-10 16:25:58
Node:                                mon

Category:                           LinStorException
Class name:                         SystemServiceStartException
Class canonical name:               com.linbit.SystemServiceStartException
Generated at:                       Method 'initialize', Source file 'DbConnectionPoolInitializer.java', Line #69

Error message:                      Database initialization error

ErrorContext:
Call backtrace:

   Method                                   Native Class:Line number
    setTransactionIsolation                  N      com.linbit.linstor.dbcp.DbConnectionPool:548
    migrate                                  N      com.linbit.linstor.dbcp.DbConnectionPool:213
    initialize                               N      com.linbit.linstor.dbcp.DbConnectionPoolInitializer:61
    startSystemServices                      N      com.linbit.linstor.core.ApplicationLifecycleManager:87
    start                                    N      com.linbit.linstor.core.Controller:361
    main                                     N      com.linbit.linstor.core.Controller:609

Caused by:
==========

Category:                           Exception
Class name:                         SQLException
Class canonical name:               java.sql.SQLException
Generated at:                       Method 'getConnection', Source file 'DriverManager.java', Line #702

Error message:                      No suitable driver found for jdbc:mysql://mysql/linstor?createDatabaseIfNotExist=true

Call backtrace:
 Method                                   Native Class:Line number
    getConnection                            N      java.sql.DriverManager:702
    getConnection                            N      java.sql.DriverManager:189
    createConnection                         N      org.apache.commons.dbcp2.DriverManagerConnectionFactory:123
    makeObject                               N      org.apache.commons.dbcp2.PoolableConnectionFactory:355
    create                                   N      org.apache.commons.pool2.impl.GenericObjectPool:889
    borrowObject                             N      org.apache.commons.pool2.impl.GenericObjectPool:424
    borrowObject                             N      org.apache.commons.pool2.impl.GenericObjectPool:349
    getConnection                            N      org.apache.commons.dbcp2.PoolingDataSource:134
    setTransactionIsolation                  N      com.linbit.linstor.dbcp.DbConnectionPool:540
    migrate                                  N      com.linbit.linstor.dbcp.DbConnectionPool:213
    initialize                               N      com.linbit.linstor.dbcp.DbConnectionPoolInitializer:61
    startSystemServices                      N      com.linbit.linstor.core.ApplicationLifecycleManager:87
    start                                    N      com.linbit.linstor.core.Controller:361
    main                                     N      com.linbit.linstor.core.Controller:609
ghernadi commented 1 year ago

The error message only states that you are missing the JDBC driver for mysql. Please get the corresponding .jar file, and put it into /usr/share/linstor-server/lib/ on the controller.

drev74 commented 3 months ago

I'm also having this issue a year later after the bug report. I followed the docs to set up MySQL as a database for Linstor, but still can't make it work. I'm able to login with my linstor user to the linstor database from command line, so there's an issue with Linstor inself.

OS: Ubuntu 22.04 MySQL: 8.0.39

Error report:

ERROR REPORT 66C0D47C-00000-000000

============================================================

Application:                        LINBIT® LINSTOR
Module:                             Controller
Version:                            1.29.0
Build ID:                           b2be7208a777f0743d4c7187062678cd5416fccf
Build time:                         2024-07-31T11:02:51+00:00
Error time:                         2024-08-17 16:49:03
Node:                               hyp0
Thread:                             Main

============================================================

Reported error:
===============

Category:                           LinStorException
Class name:                         SystemServiceStartException
Class canonical name:               com.linbit.SystemServiceStartException
Generated at:                       Method 'initialize', Source file 'DbConnectionPoolInitializer.java', Line #71

Error message:                      Database initialization error

ErrorContext:

Call backtrace:

    Method                                   Native Class:Line number
    initialize                               N      com.linbit.linstor.dbcp.DbConnectionPoolInitializer:71
    startSystemServices                      N      com.linbit.linstor.core.ApplicationLifecycleManager:88
    start                                    N      com.linbit.linstor.core.Controller:375
    main                                     N      com.linbit.linstor.core.Controller:627

Caused by:
==========

Category:                           RuntimeException
Class name:                         LinStorDBRuntimeException
Class canonical name:               com.linbit.linstor.LinStorDBRuntimeException
Generated at:                       Method 'setTransactionIsolation', Source file 'DbConnectionPool.java', Line #553

Error message:                      Failed to set transaction isolation

ErrorContext: 

Call backtrace:

    Method                                   Native Class:Line number
    setTransactionIsolation                  N      com.linbit.linstor.dbcp.DbConnectionPool:553
    migrate                                  N      com.linbit.linstor.dbcp.DbConnectionPool:215
    initialize                               N      com.linbit.linstor.dbcp.DbConnectionPoolInitializer:63
    startSystemServices                      N      com.linbit.linstor.core.ApplicationLifecycleManager:88
    start                                    N      com.linbit.linstor.core.Controller:375
    main                                     N      com.linbit.linstor.core.Controller:627

Caused by:
==========

Category:                           Exception
Class name:                         SQLException
Class canonical name:               java.sql.SQLException
Generated at:                       Method 'getConnection', Source file 'DriverManager.java', Line #702

Error message:                      No suitable driver found for jdbc:mysql://hyp0/linstor?createDatabaseIfNotExist=true

Call backtrace:

    Method                                   Native Class:Line number
    getConnection                            N      java.sql.DriverManager:702
    getConnection                            N      java.sql.DriverManager:189
    createConnection                         N      org.apache.commons.dbcp2.DriverManagerConnectionFactory:123
    makeObject                               N      org.apache.commons.dbcp2.PoolableConnectionFactory:355
    create                                   N      org.apache.commons.pool2.impl.GenericObjectPool:889
    borrowObject                             N      org.apache.commons.pool2.impl.GenericObjectPool:424
    borrowObject                             N      org.apache.commons.pool2.impl.GenericObjectPool:349
    getConnection                            N      org.apache.commons.dbcp2.PoolingDataSource:134
    setTransactionIsolation                  N      com.linbit.linstor.dbcp.DbConnectionPool:545
    migrate                                  N      com.linbit.linstor.dbcp.DbConnectionPool:215
    initialize                               N      com.linbit.linstor.dbcp.DbConnectionPoolInitializer:63
    startSystemServices                      N      com.linbit.linstor.core.ApplicationLifecycleManager:88
    start                                    N      com.linbit.linstor.core.Controller:375
    main                                     N      com.linbit.linstor.core.Controller:627

END OF ERROR REPORT.
rp- commented 3 months ago
  1. question do you have this file? /usr/share/linstor-server/lib/mariadb-java-client-3.1.4.jar

If so, it might be that you need the specific mysql connector for mysql DB. So you could try to delete/remove the file above and download the mysql jdbc driver and try with that one

drev74 commented 3 months ago

@rp- why do I need to check some files ? Do you even have QA for your project ?

I followed YOUR docs and instructions and YOUR code doesn't work. Pls add this to QA and verify on your own first :point_up:

raltnoeder commented 3 months ago

Not sure who put MySQL on the list of supported databases, or if it is actually on the list, and who tested it or how, but even MariaDB was only added later, and at the time where that happened, MySQL still had problems with incomplete support of required datatypes, constraints, checks, and also cannot perform structural changes in a transaction.

I am the guy who wrote the first line of code for LINSTOR, and it was originally designed for PostgreSQL, then Derby was added, and that was migrated to H2. Anyhow, long story short, if you want the most robust solution, I recommend to use PostgreSQL.

drev74 commented 3 months ago

@raltnoeder Thank you for a detailed response. I appreciate your work on DB support and linstor itself.

  1. Yes, you DO have MySQL support in your user_manual
  2. No problem to use Postgres. I have been using MySQL for another service and just wanted to reuse.

Anyway, I really support and appreciate your work on Linstor and would like to contribute with docs/support/bug fixing to this project

tetra12 commented 3 months ago

Closing this as an unsupported feature