首页 > 解决方案 > 如何在 Hyperledger Fabric-ca 中将 Mysql 添加为数据库?

问题描述

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

标签: mysqlhyperledger-fabrichyperledger

解决方案


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

# ...


推荐阅读