简体   繁体   中英

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 }'

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 and index at creDate (eg db.entities.createIndex({creDate:1}) ) and maybe more, if you use orderBy param in your NGSIv2 queries. More detail here
  • Due to Azure Cosmos DB limitations, the transient entities feature in Orion is not available.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM