如何在 hyperledger fabric-ca 中添加 Mysql 作为数据库?

How to add Mysql as a db in hyperledger fabric-ca?

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

为什么 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

# ...