postgresql - 固件:创建 Postgresql

标签 postgresql fiware fiware-cygnus

安装并运行 Cygnus(订阅 Orion)。 Orion 接收来自客户端的通知(通过 ioagent)。如何启动和创建持久性 postgresql 数据库?

从远程服务器访问固件。不确定要执行什么命令并启动 postgres。

最佳答案

有一个 FIWARE 教程可用于将历史数据保存到 PostGres

docker-compose 中,PostGres 可以设置如下:

postgres-db:
    image: postgres
    hostname: postgres-db
    container_name: db-postgres
    expose:
        - "5432"
    ports:
        - "5432:5432"
    networks:
        - default
    environment:
        - "POSTGRES_PASSWORD=password"
        - "POSTGRES_USER=postgres"
        - "POSTGRES_DB=postgres"

Cygnus 配置镜像 PostGre 配置,如下所示:

cygnus:
    image: fiware/cygnus-ngsi
    hostname: cygnus
    container_name: fiware-cygnus
    networks:
        - default
    depends_on:
        - postgres-db
    expose:
        - "5080"
    ports:
        - "5050:5050"
        - "5080:5080"
    environment:
        - "CYGNUS_POSTGRESQL_HOST=postgres-db"
        - "CYGNUS_POSTGRESQL_PORT=5432"
        - "CYGNUS_POSTGRESQL_USER=postgres"
        - "CYGNUS_POSTGRESQL_PASS=password"
        - "CYGNUS_SERVICE_PORT=5050"
        - "CYGNUS_API_PORT=5080"
        - "CYGNUS_POSTGRESQL_ENABLE_CACHE=true"

当触发对 Cygnus 的订阅时,应实例化数据库实例。

例如:

curl -iX POST \
  'http://orion:1026/v2/subscriptions' \
  -H 'Content-Type: application/json' \
  -H 'fiware-service: <xxxxxx>' \
  -H 'fiware-servicepath: <yyyyyy>' \
  -d '{
  "description": "Notify Cygnus of all context changes",
  "subject": {
    "entities": [
      {
        "idPattern": ".*"
      }
    ]
  },
  "notification": {
    "http": {
      "url": "http://cygnus:5050/notify"
    },
    "attrsFormat": "legacy"
  },
  "throttling": 5
}'

关于postgresql - 固件:创建 Postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53485923/

相关文章:

ssl - 如何使 Orion Context Broker 使用 HTTPS 通知?

objective-c - 如何从 iOS 应用程序连接 FIWARE

固件 Orion : Geolocation Filters for Subscriptions

fiware-orion - 使用 Docker-compose 安装的 Cygnus-ngsi 不会将数据保存在 MongoDB 中

javascript - Postgres、Sequelize 和 Express

database - Postgres 中的字符串;验证字符串的内容

sql - PostgreSQL : Pattern matching of values starting with "IR"

postgresql - Spring JDBC - 最后插入的 id

Fiware - Cygnus : Issue with collection's names

hadoop - Fiware-Cosmos MapReduce