...
This limitation requires the use of a software component outside of Ubersmith and its associated database to provide a locking mechanism. Ubersmith has chosen Apache Zookeeper Redis for this purpose.
ZooKeeper is a centralized service for maintaining configuration information, naming, providing distributed synchronization, and providing group services.
The PHP Zookeeper PECL module must be installed on all web frontend hosts that will be communicating with the Zookeeper server(s). This module can be installed using the command:
# pecl install zookeeper-VERSIONAs of this writing, the current version is 0.2.2:
# pecl install zookeeper-0.2.2Zookeeper Configuration
Installing Zookeeper
...
Redis is an open source, in-memory data structure store, used as a database, cache and message broker.
Redis Configuration
Installing Redis
Ubersmith provides a Redis container configuration which can be brought online by running the following command as root from your Ubersmith installation directory:
docker-compose -p ubersmith up --scale redis=3 -d redis
This command will automatically bring up a cluster of three Redis containers.
Updating Ubersmith's config.ini.php
Ubersmith's default behavior is to use MySQL's internal GET_LOCK function for advisory locking, so it's necessary to reconfigure the system to make it aware of the new Zookeeper Redis installation.
Add a Zookeeper configuration block to config.ini.php file (located above the Ubersmith web root on the Ubersmith server):
[uber_lock]
backend = zookeeper
servers = 127.0.0.1:2181In this case, the servers configuration option refers to the IP address and port for the Zookeeper instance. In this example, Zookeeper is running on the same host as Ubersmith (note the use of the 127.0.0.1 loopback address) with a port of 2181 for inbound connections. If a Zookeeper Ensemble is to be implemented, the servers entry should be a comma delimited list of IPs and ports for each host in the ensemble. For example:
[uber_lock]
backend = zookeeper
servers = 10.0.0.1:2181,10.0.0.2:2181,10.0.0.3:2181Verify that the configuration is functional by logging into Ubersmith. If login is successful, Zookeeper is handling Ubersmith's locking requestsEdit docker-compose.override.yml and uncomment the following lines:
| Блок кода |
|---|
# LOCK_BACKEND: redis
# LOCK_SERVERS: "ubersmith_redis_1:6379:1,ubersmith_redis_2:6379:1,ubersmith_redis_3:6379:1" |
With those lines uncommented, run the following command as root:
docker-compose -p ubersmith up -d web
This will reconfigure Ubersmith to use Redis for advisory locking.
Migration from standalone MySQL
...