- How to?
- Required configuration
- Running the image (creation of the container)
- Notes (important)
- Server to Server replication
- Example of bidirectional replication between two HFSQL docker containers
Docker image of the HFSQL server
From version 22, a Docker container with the HFSQL server is available in Docker Hub:https://hub.docker.com/r/windev/hfsql
Installing an HFSQL server is really simple: 1 line to type or script!
Remark: Only the 64-bit version is available.
The Linux distribution used does not matter. However, to use the Docker container that contains the HFSQL server, it is necessary to be familiar with Docker and, in particular:
- know how to install a new container from the Docker image of the HFSQL server,
- manage at least one volume required for data persistence,
- manage network configuration inside Docker.
Running the image (creation of the container)
- The name of the preset image is:
- To persist data (e.g. if the image changes), you must:
- Use a volume. The command to create a volume:
"docker volume create <VolumeName>"
- Mount the volume into the container on
- Example of command line:
Here are the parameters of the command above:
sudo docker run -d
- "name": indicates the name of the container.
- "volume": indicates the "binding" between the volume and the directory defined in the container. In the HFSQL server configuration, the database path will be seen as "var/lib/hfsql".
- "publish": indicates the container access port (4923 in this example) and the redirection to the port inside the container (4900: HFSQL standard port).
In this example, the server will be accessible on port 4923 of the docker server.
- the name of the docker package and the HFSQL version (US230053b" in this example).
- When the container is created, if there are no databases, you can define environment variables, for example, via the syntax:
You can use one of the following three variables (or nothing for the default "admin" mode):
You can also use the following variable (optional): HFSQL_USER: Name of the account (admin by default.)
- HFSQL_PASSWORD: Password of the initial account.
- HFSQL_PASSWORD_FILE: Path of the file that contains the password of the initial account.
- HFSQL_RANDOM_PASSWORD: The password for the initial account is generated randomly
It is displayed on the standard output and can be found in the logs with the command
- Reminder of basic Docker commands:
- Stop a container:
- Restart a container:
Server to Server replication
"Server to Server" replication is not possible with the default HFSQL Docker image.
To perform this type of replication, a derived image must be made adding the port used for replication.
The new Docker image can be for example:
Example of bidirectional replication between two HFSQL docker containers
To set up bidirectional replication between two HFSQL Docker containers running on the same machine:
- Create a Dockerfile with this content:
- Create the Docker image with this command line (include the full stop):
sudo docker build --force-rm -t hfsql:replication .
- Create a volume for the first server:
sudo docker volume create vol_hfsql_4901
- Install and run the first server:
sudo docker run -dit --restart unless-stopped --name HFSQL_4901
--publish 4996:4996 hfsql:replication
- Create a volume for the second server:
sudo docker volume create vol_hfsql_4902
- Install and run the second server:
sudo docker run -dit --restart unless-stopped --name HFSQL_4902
--volume vol_hfsql_4902:/var/lib/hfsql --publish 4902:4900
--publish 4997:4997 hfsql:replication
The rest of the configuration can be defined in the HFSQL Control Center (standard method to create a bidirectional replication between two servers).
This page is also available for…