如何在Hyperledger Fabric-ca中将Mysql添加为数据库?

时间:2019-10-15 14:13:28

标签: mysql hyperledger-fabric hyperledger

我想将我的应用程序投入生产,因此我想将mysql作为db添加到fabric-ca中。有人尝试过吗?我已经坚持了一个星期,在互联网上找不到任何内容。

1 个答案:

答案 0 :(得分:2)

为什么是mysql,而不是PostgreSQL?

类似...

# docker-compose.yaml

version: '2.4'

services:

  postgres:
    image: postgres:10.3-alpine
    restart: unless-stopped
    environment:
      - POSTGRES_DB=ca
      - POSTGRES_USER=admin_postgres
      - POSTGRES_PASSWORD=admin_postgres_password
    volumes:
      - /volumes/ca_postgres:/var/lib/postgresql/data

  fabric-ca:
    image: hyperledger/fabric-ca:1.4
    restart: unless-stopped
    environment:
      - FABRIC_CA_SERVER_PORT=7054
      - FABRIC_CA_HOME=/root/home
    volumes:
      - /volumes/ca_home:/root/home
    ports:
      - 7054:7054

您必须事先将fabric-ca-server-config.yaml准备到FABRIC_CA_HOME中:

# fabric-ca-server-config.yaml

# ...

db:
  type: postgres
  datasource: host=postgres port=5432 user=admin_postgres password=admin_postgres_password dbname=ca sslmode=disable

# ...