Heray-Was-Here
Server : Apache
System : Linux ip-172-26-6-158 5.10.0-35-cloud-amd64 #1 SMP Debian 5.10.237-1 (2025-05-19) x86_64
User : daemon ( 1)
PHP Version : 8.1.10
Disable Function : NONE
Directory :  /opt/bitnami/wordpress/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //opt/bitnami/wordpress/db-config.php
<?php

/*
Configuration generated automatically on Thu Mar 11 20:24:04 2021
*/

/**
 * LudicrousDB configuration file
 *
 * This file should be copied to ABSPATH/db-config.php and modified to suit your
 * database environment. This file comes with a basic configuration by default.
 *
 * See README.md for documentation.
 */
// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
/**
 * charset (string)
 * This sets the default character set. Since WordPress 4.2, the suggested
 * setting is "utf8mb4". We strongly recommend not downgrading to utf8,
 * using latin1, or sticking to the default: utf8mb4.
 *
 * Default: utf8mb4
 */
$wpdb->charset = 'utf8mb4';
/**
 * collate (string)
 * This sets the default column collation. For best results, investigate which
 * collation is recommended for your specific character set.
 *
 * Default: utf8mb4_unicode_ci
 */
$wpdb->collate = 'utf8mb4_unicode_ci';
/**
 * save_queries (bool)
 * This is useful for debugging. Queries are saved in $wpdb->queries. It is not
 * a constant because you might want to use it momentarily.
 * Default: false
 */
$wpdb->save_queries = false;
/**
 * persistent (bool)
 * This determines whether to use mysql_connect or mysql_pconnect. The effects
 * of this setting may vary and should be carefully tested.
 * Default: false
 */
$wpdb->persistent = false;
/**
 * max_connections (int)
 * This is the number of mysql connections to keep open. Increase if you expect
 * to reuse a lot of connections to different servers. This is ignored if you
 * enable persistent connections.
 * Default: 10
 */
$wpdb->max_connections = 10;
/**
 * check_tcp_responsiveness
 * Enables checking TCP responsiveness by fsockopen prior to mysql_connect or
 * mysql_pconnect. This was added because PHP's mysql functions do not provide
 * a variable timeout setting. Disabling it may improve average performance by
 * a very tiny margin but lose protection against connections failing slowly.
 * Default: true
 */
$wpdb->check_tcp_responsiveness = true;
/**
 * This is the most basic way to add a server to LudicrousDB using only the
 * required parameters: host, user, password, name.
 * This adds the DB defined in wp-config.php as a read/write server for
 * the 'global' dataset. (Every table is in 'global' by default.)
 */



$current_host = gethostname();


# notes
# app1-c17: 192.168.208.90
# app2-c17: 192.168.194.131

if ( $current_host == 'app1-c17' ) {

    # we are on app1-c17, so :
    # localhost: read (1) and write (1)
    # other-node: read (2) and write (2)
    $wpdb->add_database(array(
        'host'     => '127.0.0.1',     // If port is other than 3306, use host:port.
        'user'     => DB_USER,
        'password' => DB_PASSWORD,
        'name'     => DB_NAME,
        'write'    => 1,
        'read'     => 1,
    ));

    $wpdb->add_database(array(
        'host'     => '192.168.194.131',     // put here the value of app2-c17
        'user'     => DB_USER,
        'password' => DB_PASSWORD,
        'name'     => DB_NAME,
        'write'    => 2,
        'read'     => 2,
    ));
}

if ( $current_host == 'app2-c17' ) {
    # we are on app2-c17, so :
    # localhost: read (1) and write (2)
    # other-node: read (2) and write (1)
    $wpdb->add_database(array(
        'host'     => '127.0.0.1',     // If port is other than 3306, use host:port.
        'user'     => DB_USER,
        'password' => DB_PASSWORD,
        'name'     => DB_NAME,
        'write'    => 2,
        'read'     => 1,
    ));

    $wpdb->add_database(array(
        'host'     => '192.168.208.90',     // put here the value of app1-c17
        'user'     => DB_USER,
        'password' => DB_PASSWORD,
        'name'     => DB_NAME,
        'write'    => 1,
        'read'     => 2,
    ));
}

Hry