Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.7k views
in Technique[技术] by (71.8m points)

symfony - How to change keep_slave for keep_replica connection for doctrine

I want change master/slave naming for primary/replica in my doctrine configuration.

doctrine:
dbal:
    default_connection: primary
    connections:
        primary:
            host:     '%db.primary.host%'
            port:     '%db.primary.port%'
            dbname:   '%db.primary.name%'
            user:     '%db.primary.user%'
            password: '%db.primary.password%'
            server_version: '%db.primary.version%'                
            keep_replica: true
            replicas:
                replica1:
                    host:     '%db.replica.host%'
                    port:     '%db.replica.port%'
                    dbname:   '%db.replica.name%'
                    user:     '%db.replica.user%'
                    password: '%db.replica.password%'
                    charset:  utf8mb4

        replica:
            host:     '%db.replica.host%'
            port:     '%db.replica.port%'
            dbname:   '%db.replica.name%'
            user:     '%db.replica.user%'
            password: '%db.replica.password%'
            server_version: '%db.replica.version%'
            

But when i try install it, i got error:

Unrecognized options “keep_replica, replicas” under “doctrine.dbal.connecti
ons.primary”. Available options are “MultipleActiveResultSets”, “applicatio
n_name”, “auto_commit”, “charset”, “connectstring”, “dbname”, “default_dbna
me”, “default_table_options”, “driver”, “driver_class”, “host”, “instancena
me”, “keep_slave”, “logging”, “mapping_types”, “memory”, “options”, “passwo
rd”, “path”, “persistent”, “platform_service”, “pooled”, “port”, “profiling
“, “profiling_collect_backtrace”, “protocol”, “schema_filter”, “server”, “s
erver_version”, “service”, “servicename”, “sessionMode”, “shard_choser”, “s
hard_choser_service”, “shard_manager_class”, “shards”, “slaves”, “sslcert”,
“sslcrl”, “sslkey”, “sslmode”, “sslrootcert”, “unix_socket”, “url”, “use_s
avepoints”, “user”, “wrapper_class”.

I made configuration due to this doc - https://symfony.com/doc/current/bundles/DoctrineBundle/configuration.html

My dependencies is

beberlei/assert                                v3.3.0             
beberlei/doctrineextensions                    v1.3.0             

doctrine/annotations                           1.11.1             
doctrine/cache                                 1.10.2             
doctrine/collections                           1.6.7              
doctrine/common                                2.13.3             
doctrine/dbal                                  2.12.1             
doctrine/doctrine-bundle                       1.12.13            
doctrine/doctrine-cache-bundle                 1.4.0              
doctrine/event-manager                         1.1.1              
doctrine/inflector                             1.4.3              
doctrine/instantiator                          1.4.0             
doctrine/lexer                                 1.2.1              
doctrine/orm                                   2.7.5              
doctrine/persistence                           1.3.8   

And due to dbal 2.12.1 it must work, but doesn't

question from:https://stackoverflow.com/questions/65845667/how-to-change-keep-slave-for-keep-replica-connection-for-doctrine

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...