TYPO3 CMS Cluster in the Jelastic Cloud

    TYPO3 is a great solution for websites of all sizes, from small to corporate. This CMS makes it easy to create and manage multilingual corporate sites for large organizations. Such websites can scale and adapt to any emerging needs.

    Jelastic makes it possible to make your site on TYPO3 not only very flexible and affordable, but also stable and high-performance. To achieve this result, you must configure a highly accessible cluster with two Apache application servers , an NGINX balancer , a Memcached node, and two replicated MySQL databases .

    typo cluster

    Memcached server is used to store Apache server sessions. Thanks to the backup of sessions, if one of the Apache servers fails, then the second “picks up” sessions from the Memcached node and continues to process them. The NGINX balancer distributes traffic within the cluster. In addition, replication of the main and subordinate MySQL databases improves performance, increases the reliability of data availability and the resiliency of your environment.

    Now let's get started with the step-by-step configuration of a highly accessible clustered TYPO3 application.

    A. Deploy TYPO3 application


    First of all, you need to create the necessary Jelastic environment and deploy the TYPO3 application.

    1. Register (if you have not done this before) or log in to your Jelastiс account.

    2. Click Create Environment .

    3. Select the Apache application server , MySQL database, and Memcached node . Set the limits of cloudletts and enter the environment name (for example, typo-cluster ). Click Create .

    create an environment

    4. Wait for the environment to be created.

    environment

    5. Go to the official TYPO3 website and download the zip archive with the latest version of the application.

    typo site

    6. UsingDistribution Manager download the archive to the control panel.

    upload archive

    7. Then deploy it to your newly created environment.

    deploy application

    To install and run your TYPO3 application, you need to disable the zend_extension extension .
    Go to etc> php.ini file and comment out the following line:

    #zend_extension=/usr/lib64/php/modules/opcache.so

    disable extension

    B. Configuring clustering PHP sessions


    High availability of PHP applications can be achieved by using clustering of PHP sessions in the cloud. To maintain operability in the event of an application server failure (in the next steps of the instructions we will add another server) we will use Memcached.

    1. Click the Configure button for the Apache server . In the configuration manager, open the etc> php.ini file and enable the Memcached module by adding the following line:

    extension=memcached.so

    memcached

    2. To activate support for working with sessions, add the following lines to the Session block of the php.ini configuration file :

    session.save_handler = memcached
    session.save_path = ":11211"

    memcached session

    Instead 3. Save the changes and restart the Apache server. нужно прописать IP адрес Memcached сервера. Чтобы узнать его, нажмите кнопку Информация для Memcached ноды в окружении.
    IP address

    Memcached



    restart the server

    C. Database setup


    The next step is to configure MySQL database replication (master and slave) to protect the application from downtime or data loss.

    MySQL in an environment with deployed TYPO3 will be used as the main base. For a subordinate base, you need to create a separate environment.

    Go to the Jelastic control panel and create a new environment with the MySQL node, which will be used as a sub base. Name your environment (for example, slave-db) and click Create .

    subordinate base

    And now let's configure each database individually:

    Main database


    As mentioned above, we use MySQL in an environment with a deployed application (i.e. typo-cluster ) as our main database.

    1. Click the Configuration button for the main database.

    main base configuration

    2. Go to the my.cnf file in the etc folder and set the following parameters as shown in the image below (you need to uncomment only two lines):

    server-id = 1
    log-bin = mysql-bin
    binlog-format=mixed

    my.cnf

    We use binlog-format = mixed to enable replication of foreign key operations.

    Do not use binlog_format = statement , otherwise errors will subsequently occur!

    3. Save the changes and Restart MySQL to apply the new configuration parameters.

    restart mysql

    4. Click the Open button in a browser near the main MySQL database. Log in to the MySQL admin panel using the credentials you received by email after creating the environment.

    Open in MySQL browser

    5. Go to the Replication tab and click Add Replication Subordinate .

    Add Replication Subordinate

    6. Enter a name and password for the replication subordinate user and click OK .

    username and password for subordinate user

    Your subordinate user has been created successfully.

    subordinate user created

    Slave database


    Now let's establish a connection between the main and subordinate MySQL databases.

    1. Click the Configuration button for the sub database.

    slave base configuration

    2. Open the etc> my.cnf file and add the following lines:

    server-id = 2
    slave-skip-errors = all

    my.cnf subordinate MySQL

    We allow our subordinate database to skip all errors of the main ( slave-skip-errors = all ) so as not to interrupt normal operation in case of their occurrence.

    This is not recommended at the development stage in order to be able to find bugs, etc. However, in this manual, we focus on the production phase when your code has already been tested. Any error on the side of the main base, even a minor one, can stop the subordinate or lead to desynchronization.

    3. Save the changes and Restart the slave database server to apply the new configuration settings.

    restart the slave database server

    4. Log in to phpMyAdminusing the account information that Jelastic sent you when creating the environment for the subordinate database.

    5. Go to the Replication tab and click the settings in the Replication section of the slave server .

    Slave server replication

    6. Configure the master server (enter the name, password, and replication slave host).

    slave name, password, and host

    Now the main server is configured.

    the main server is configured

    7. Click on Control slave> Full start for the slave server to start the Slave SQL and Slave IO streams.

    Slave SQL and Slave IO streams

    8. Check the status table of the slave server to make sure everything is in order.

    slave server status table

    As a result, replication is configured and all data is synchronized between the master and slave databases.

    D. Installing TYPO3


    Now we can complete the installation of TYPO3.

    1. Go to the Jelastic control panel and click the Open button in the browser for the environment with TYPO3. Installation begins. Click Continue .

    Open in browser TYPO3

    2. In the Connect to your database host window :
    • select MySQL / MySQLi driver
    • fill in the Username and Password fields with the credentials of your main database (received by e-mail when creating the environment)
    • in the Host field enter the address of the database server

    Click Continue .

    Connect to your database host

    3. At the Select database stage, create a new database: enter a name for the TYPO3 database (for example, typo_db ) and click Continue .

    Thanks to the database replication that we configured earlier, the created database will automatically appear on both MySQL servers, the master and the slave.

    Select database

    4. In the next window, select the Introduction package . Click Continue .

    Introduction package

    5. Installation begins. Wait a few minutes to complete it.

    installation package introduction

    6. Finally, enter the password to access the TYPO3 admin panel and select the color of the TYPO3 main page.

    image

    Congratulations! TYPO3 installed.

    TYPO3 installed

    E. Cluster Configuration


    After the installation of TYPO3 was successfully completed, we can begin to configure a highly accessible cluster.

    1. Open the Jelastic control panel and click the Change environment topology button for the environment with the TYPO3 application.

    Change environment topology

    2. Add another Apache application server by clicking the + button (highlighted in the image below). The NGINX balance will be added automatically. Click Apply .

    another Apache application server


    Open cluster in browser

    Your highly reliable and scalable clustered solution with TYPO3 installed is ready to use. Click Open in browser and get started.

    TYPO3 ready to use

    Using another TYPO3 clustering method? Please share your experience with us in the comments below.

    Also popular now: