固件:创建 Postgresql
Fiware: Create Postgresql
安装了 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
}'
安装了 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
}'