'using fiware orion with azure cosmos db mongo api
We are currently using fiware Orion with Mongo DB on a docker container in a Kubernetes cluster and everything works fine, however as soon as I am trying to use it with Azure CosmosDB mongo API things fall apart.
Below is the yaml
apiVersion: v1
kind: Namespace
metadata:
name: fiware
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: orion
namespace: fiware
spec:
replicas: 1
selector:
matchLabels:
app: orion
template:
metadata:
labels:
app: orion
spec:
containers:
- name: orion
image: fiware/orion:2.5.2
ports:
- containerPort: 1026
name: http
protocol: TCP
args: ["-dbhost", "<<HOST HERE>>:<<PORT>>", "-db", "<<DB>>", "-dbuser", "<<USER>>", "-dbpwd","<<PWD>>", "-dbSSL", "-rplSet","globaldb","-dbAuthDb","admin", "-httpTimeout","15000", "-logLevel", "INFO"]
---
apiVersion: v1
kind: Service
metadata:
name: orion
namespace: fiware
spec:
selector:
app: orion
type: LoadBalancer
ports:
- port: 1026
protocol: TCP
targetPort: 1026
nodePort: 30000
ERROR :
time=2021-03-05T04:05:45.784Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=safeMongo.cpp[360]:getField | msg=Runtime Error (field '_id' is missing in BSONObj <{ cursor: { id: 0, ns: "orion.csubs", firstBatch: [] }, ok: 1.0 }> from caller mongoSubCacheItemInsert:83)
time=2021-03-05T04:05:45.784Z | lvl=ERROR | corr=N/A | trans=N/A | from=N/A | srv=N/A | subsrv=N/A | comp=Orion | op=AlarmManager.cpp[211]:dbError | msg=Raising alarm DatabaseError: error retrieving _id field in doc: '{ cursor: { id: 0, ns: "orion.csubs", firstBatch: [] }, ok: 1.0 }'
Solution 1:[1]
Since version 3.0.0, Orion is able to connect to Azure Cosmos DB. Details can be found here. Pay special attention to the following considerations:
- You need to start Orion using
-dbDisableRetryWrites
- You need to create an index at
creDate
(e.g.db.entities.createIndex({creDate:1})
) and maybe more, if you useorderBy
param in your NGSIv2 queries. More detail here - Due to Azure Cosmos DB limitations, the transient entities feature in Orion is not available.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |