Skip to content

Latest commit

 

History

History
89 lines (67 loc) · 1.79 KB

README.md

File metadata and controls

89 lines (67 loc) · 1.79 KB

dbpack-samples

Step0: Clone dbpack and dbpack-samples

git clone [email protected]:cectc/dbpack.git
git clone [email protected]:cectc/dbpack-samples.git
cd dbpack-samples/python

Step1: Manual startup

Step1.1: Setup etcd

docker run -d --name etcd-server \
    --publish 2379:2379 \
    --publish 2380:2380 \
    --env ALLOW_NONE_AUTHENTICATION=yes \
    --env ETCD_ADVERTISE_CLIENT_URLS=http://etcd-server:2379 \
    bitnami/etcd:latest

Step1.2: Setup mysql, initialize the database with the following sql script

./scripts/order.sql
./scripts/product.sql

Step1.3: run dbpack

vim ./configs/config-aggregation.yaml
# update distributed_transaction.etcd_config.endpoints

vim ./configs/config-product.yaml
# update data_source_cluster.dsn
# update distributed_transaction.etcd_config.endpoints

vim ./configs/config-order.yaml
# update data_source_cluster.dsn
# update distributed_transaction.etcd_config.endpoints

cd ../dbpack

make build-local

./dist/dbpack start --config ../dbpack-samples/configs/config-aggregation.yaml

./dist/dbpack start --config ../dbpack-samples/configs/config-product.yaml

./dist/dbpack start --config ../dbpack-samples/configs/config-order.yaml

Step1.4: setup python requirements

cd ../dbpack-samples/python
pip3 install -r requirements.txt

Step1.5: setup aggregation client

cd ../dbpack-samples/python/aggregation

python3 app.py

Step1.6: setup order client

cd ../dbpack-samples/python/order

python3 app.py

Step1.7: setup product client

cd ../dbpack-samples/python/product

python3 app.py

Step2: Automatic startup

cd ../dbpack-samples/python

docker-compose up --build

Step3: access and test

curl -XPOST http://localhost:13000/v1/order/create