Machine learning service setup
Machine learning service is used for predicting values based on large volumes of historical data and current facts. Read more >>>
Attention
Base knowledge of Docker, Linux or Windows administration is required to set up the machine learning service.
Contents
•Preparing for the machine learning service setup
•Machine learning service setup
•Updating the machine learning service components
Preparing for the machine learning service setup
To set up the service, you need to have a server (physical or virtual machine) with Linux or Windows OS installed. Docker software is used for installing the service components. Download the archive containing the configuration files and installation scripts. Download archive
Attention
We recommend using Linux-based server for production environment. You can only use a Windows based server for the development environment. Contact the support service to receive Docker containers that care compatible with Windows.
Note
Depending on your company needs you can use either Docker Community Edition (CE) or Enterprise Edition (EE). Learn more in the Docker Guide.
Recommended system requirements to the server
Processor | 64-Bit processor, minimum 4 cores |
RAM | 8 GB or more |
HDD | 20 GB or more of hard drive free space |
OS | Linux application setup files supporting Docker. Supported Linux families are covered in the Docker guide. We recommend using stable Ubuntu or Debian versions. 64-Bit versions of Windows 10, Windows Server 2016 that support the Hyper-V technology. |
Docker | v.18.03.1 and higher |
Machine learning service components
The machine learning service uses the following components (Fig. 1):
-
ML Service – machine learning web service. The only component enabling external access.
-
R Engine – machine learning engine, which is basically a service wrapper over open-source machine learning libraries.
-
Redis – session and cache storage server. Read more >>>
-
ML Task Scheduler – task scheduler.
-
MySQL– MySQL database. You can access it via the standard 3306 port.
All the components are packed as Docker images for the convenient on-site installing of the service.
Machine learning service setup
Algorithm of machine learning service setup:
1.Install Docker. Read more >>>
2.Install Docker Compose. Read more >>>
3.Install and set up the service components. Read more >>>
4.Verify the installation. Read more >>>
Installing Docker for Linux OS is covered in the Docker guide.
Run the “docker --version” command on Linux machine to verify the installed Docker version.
Installing Docker Compose for Linux OS is covered in the Docker guide.
Run the “docker-compose --version” command on Linux machine to verify the installed Docker Compose version.
Setting up the machine learning service components
All the machine learning service component containers are deployed via the Docker Compose utility. Download the configuration files and scripts that are necessary to deploy and configure the service components. Download archive
Note
The configuration files contain all necessary default settings for a Linux based server.
The archive structure of the configuration files and scripts:
\etc\
..\ml-service\appsettings.json – the ML web service configuration.
..\ml-service\log4net.config – setup of the web service logging level.
..\redis\redis.conf – Redis server setup file.
...\r-service\config.yml – the “R Engine” configuration.
..\task-scheduler\appsettings.json – the “ML Task Scheduler” utility configuration.
..\task-scheduler\log4net.config – setup of “ML Task Scheduler” logging level.
Docker-compose.yml – the “Docker Compose” utility configuration.
.env – the file containing environment variables for running the components. For example, it contains MySql password.
Attention
If you need to change the password to MySql database, you need to update it in the .env file as well as in other configuration files that contain database access setup sections.
Setting up the machine learning service components
1.Download and unzip the archive with the configuration files and scripts to a local catalog, for example, /opt/ml.
2.Using the Linux terminal, go to the /docker-compose catalog of the unzipped archive, for example, /opt/ml/docker-compose.
3.Run the “sudo docker-compose pull” command in the terminal. Wait until the download of the necessary service component images from the Docker Hub is complete.
Attention
If the server has no access to the Internet, manually download all necessary images on a computer with open access (see the “docker-compose.yml” configuration file). Then use the sudo docker export and sudo docker import commands to transfer the images to the target computer as files.
4.Run the sudo docker-compose run dbmigration command to initialize the database structure. Wait until the command execution is complete.
5.Run the sudo docker-compose up -d command to launch the services. A “logs” folder will be created in the current catalog.
Verification of setting up the machine learning service components
1.To verify the installation of ML web service, run the following command in Linux:
curl -X GET localhost:5005/readiness
The service must return the following response:
ML Service is ready
2.To verify the running of ML Task Scheduler, execute the following command in the Linux terminal:
curl -X GET localhost:5004/readiness
The service must return the following response:
L Task Scheduler is ready
3.To verify the running of R Engine, execute the following command in the Linux terminal:
curl -X GET localhost:8081/readiness
The service must return the following response:
R Service is ready
4.To verify creating of tables, run the following command in the terminal:
docker exec -it [DB Container Id] mysql -u root --password=Supervisor ml -e "show tables;"
where [DB Container Id] is an identifier of the container with a database component. You can find out the container identifier using the sudo docker ps command.
Example
Verification of creating tables:
docker exec -it [DB Container Id] mysql -u root --password=Supervisor ml -e "show tables;"
As a result, the names of primary service tables should be displayed: “modelinstance”, “traindata”, “trainsession”, etc.
Updating the machine learning service components
Attention
We recommend saving a backup copy of MySQL database, before you update the services. Learn more in the Docker Guide.
1.Using the Linux terminal, go to the docker-compose catalog with the configured files, for example, /opt/ml/docker-compose.
2.Run the sudo docker-compose stop command to stop the service component containers.
3.Run the sudo docker-compose pull command in the terminal. Wait until the download of the necessary service component images from the Docker Hub is complete.
4.Run the sudo docker-compose run dbmigration command to initialize the database structure. Wait until the command execution is complete.
5.Run the sudo docker-compose up -d command to launch the services.
See also
•Machine learning service (development guide)