Tencent transaction processing technology verification system 3TS-Coo template installation document && instruction document (newbie, simple and easy to get started)

This article will explain in detail the installation and use of the 3TS-Coo template to help you quickly get started with the project.

The first part is simple basic Docker-related concepts, which can be quickly understood in a few simple words; the
second part is the installation document for quickly installing the project environment, which can be done with just a few lines of commands, and even novices can easily get started; the
third part is Instructions for simple use of the installed project environment;

Project address: https://github.com/Tencent/3TS/tree/coo-consistency-check/


1. Why use Docker?
Normally downloading and installing various dependencies of 3ts_coo, compilation and use are too inefficient. The same project code configuration environment will cause various , strange and unexpected problems. Therefore, the image file of the project was made and deployed. Any subsequent After the platform installs the Docker environment with one click, you can pull the image file and use it with one click, thus obtaining the project environment.

2. Will using Docker to deploy the environment increase learning costs?
No, you only need to install Docker on your computer, you can pull the image with one click, and then run the container. Using the command line in the container is just like using the command line in normal Linux. Understand a few concepts and remember It is not difficult to enter and exit the command every time, and installation and uninstallation are very simple with one click and a fool's operation.

1. Quickly understand basic concepts

Docker is a tool for application packaging and deployment. The basic concepts are as follows:
Image : a template, which can be understood as a software installation package or a class
container : the instantiation of a template, which can be understood as an instantiation of a software or class that runs independently after installation. Object warehouse
: storage Various images can be understood as application stores or package managers

Packaging : Package the dependencies, third-party libraries, and software required to run your software together into an installation package.
Distribution : Upload the packaged "installation package" to a mirror warehouse so that others can easily obtain, install and deploy it
. : Use the "installation package" to run your application with one command, and automatically simulate the same operating environment across platforms

Docker novice tutorial: https://www.runoob.com/docker/docker-tutorial.html

2. Project environment installation documents

Step1. Install Docker

1. Script installation (recommended)
On a machine that has not installed Docker, execute the following command with root privileges to install the latest version of Docker with one click ( recommended ). The old version can be uninstalled with one click.

curl -s https://get.docker.com/ | sh  
sudo apt purge --autoremove docker.io

ps: It is said that the installation of Docker-compose is integrated into the above script? Check docker-compose -v. If not, execute the following script to install it with one click. It is just one more cv command to run;

The container manager docker-compose is developed in Python, so you need to install pip first (Python environments are generally installed by default)

curl -s https://bootstrap.pypa.io/get-pip.py | python3
pip install docker-compose

2. Package manager installation.
If you don’t want to use a script, you can also use the system’s own package management tool to install it.

sudo apt-get update
sudo apt-get install docker
# 先安装pip3再安装docker-compose
sudo apt-get install python3-pip
pip3 install docker-compose

Docker is a system service. You may need to start the service manually after installation (script installation is not required)

service start docker

3. Manually installing
Docker is divided into CE version and EE version. The CE version is for the open source community and is free software. Just choose CE.
Manually install the official documentation: https://docs.docker.com/engine/installation/

Step 2. Pull the image to start the project environment

1. Get the image

docker pull registry.cn-hangzhou.aliyuncs.com/open_projects/3ts_coo:1.0

2. Start the container

First Docker images check whether the image is successfully pulled, and then use the image ID to start the container.

docker run -it 镜像id /bin/bash 

3. View, enter, and exit containers ( highly used in daily use, it is recommended to remember this )

# 查看所有容器
docker ps -a
# 根据容器id ,进入想要的容器环境
docker exec -it 容器id /bin/bash
# 退出容器终端
exit

(Extended) 4. Start, stop, and restart containers

docker start  <容器 ID>
docker stop <容器 ID>
docker restart <容器 ID>

(Extended) 5. Packaging container

# 1、将容器打包成镜像,执行docker commit;
docker commit 容器id 容器名:版本

# 2、将镜像保存为本地文件,可以使用Docker save命令
docker save -o mssql-2019-with-cimb.tar mssql-2019-with-cimb

# 3、从文件载入镜像
docker load --input mssql-2019-with-cimb.tar

3. Instructions for use of project environment

Start the container and enter the project environment. The situation is as follows (focus on the line drawing file): The
Insert image description here
3ts_coo module is mainly used to check the consistency of data transactions. After the project environment is set up, you can test any database. However, as a starter, PostgreSQL is configured by default. Type The following command starts

/etc/init.d/postgresql start

isql pg -vYou can type this command to check whether the database connection is successful. When the following figure appears, the connection is successful;

Insert image description here
Step1 , edit do_test_list.txt the file and select the abnormal use case you want to test;
Step2 , edit and autorun.sh select the database and isolation level you want to test ./autorun.sh, the work is done and wait to see the results!
Insert image description here

Note 1: The configuration database username and password are omitted in Step 2, and the username and password of postgresql are configured by default; Note
2: There are two versions of the script . ./autorun.shIt is the V1 version. Just configure the database username and password of the v1 version;
Note 3: auto_test .sh and auto_test_all.sh are obsolete scripts that can be deleted;

The installation of the project can be done with one click, and the use of the project can be done in two steps. Isn’t it very easy? Of course, if you want to test other databases, here are some possible suggestions:
1. Install the database you want to test
2. Install the database connector you want to test
3. Configuration odbc.iniand odbcinst.inifiles, isql pg -vcheck the connection is successful
4. Modify ./autorun.shdatabase user name and password
5. Special databases need to be adapted accordingly;

Finally, let me review and summarize. In addition to briefly introducing the basic concepts, installation and use of docker to build the 3ts project environment, this article also explains in detail the use of the 3TS_Coo project environment, and provides an in-depth understanding and interpretation of the results . ./autorun.shThe two versions of the problem will be posted in the next article. It's too late, so I went to bed.

– 2023/09/11 0:42

Guess you like

Origin blog.csdn.net/BinBinCome/article/details/132797331