简体   繁体   中英

FIWARE QuantumLeap Sanity Check failed: QuantumLeap can't get changed data from Orion

I checked quantumLeap Sanity Check in both virtualMachine(virtualBox with Ubuntu) and production server(CentOS). With the same docker-compose.yml, the sanity check is sucessfully on virtualManchine, but failed on Production server, it's really strange, could anyone can help me? Thank you very much. @Jason Fox

The steps of sanity check is followed as https://quantumleap.readthedocs.io/en/latest/admin/check/ , I pasted below.

The difference of results is only at step 7. On virtualMachine , I can get the updated data from quantumLeap:

{
  "attrName": "precipitation",
  "entityId": "air_quality_observer_be_001",
  "index": [
    "2020-05-03T11:18:14.000",
    "2020-05-03T11:18:55.000"
  ],
  "values": [
    0.0,
    100.0
  ]
}

But on production server , the result is:

{
  "description": "No records were found for such query.",
  "error": "Not Found"
}

Note:

  1. These commands in the sanity check steps are copied to terminal, so there will be no typos.

  2. the difference of result is only at step 7. I deleted the old images on both virtualMachine and production server to let the latested images are pulled.

  3. There was a fiware-base system(orion,mongoDB,IoTAgents,quantumLeap,CrateDB,Grafana) runing on production server and everything was fine. But one week ago, the hard disk on the server was full and exhausted, and all containers are down. I cleaned some huge log files and free some space, then I bring up the fiware-base system and found that there is no data shown on Grafana. After checked, I found the reason is QuantumLeap did not store data into crateDB, but I'm not sure the root cause is orion or quantumLeap. So I decide to do the sanity check as the quantumLeap documents suggested. That's the story.

  4. BTW, the subscription of quantumLeap can be get from orion, but I can't get the changed data from quantumLeap. Why the newest changed data is not synchronized to quantumLeap?

Sanity check steps:

1.Check Orion version

curl -X GET http://0.0.0.0:1026/version -H 'Accept: application/json'

2.Check QuantumLeap version

curl -X GET http://0.0.0.0:8668/version -H 'Accept: application/json'

3.Create an Orion Subscription for "QuantumLeap"

curl -X POST \
'http://0.0.0.0:8668/v2/subscribe?orionUrl=http://orion:1026/v2&quantumleapUrl=http://quantumleap:8668/v2&entityType=AirQualityObserved' \
-H 'Accept: application/json'

4.Check you cat get such subscription from Orion

curl -X GET http://0.0.0.0:1026/v2/subscriptions \
-H 'Accept: application/json'

5.Insert an entity of AirQualityObserved into Orion

curl -X POST \
'http://0.0.0.0:1026/v2/entities?options=keyValues' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
    "id": "air_quality_observer_be_001",
    "type": "AirQualityObserved",
    "address": {
        "streetAddress": "IJzerlaan",
        "postOfficeBoxNumber": "18",
        "addressLocality": "Antwerpen",
        "addressCountry": "BE"
    },
    "dateObserved": "2017-11-03T12:37:23.734827",
    "source": "http://testing.data.from.smartsdk",
    "precipitation": 0,
    "relativeHumidity": 0.54,
    "temperature": 12.2,
    "windDirection": 186,
    "windSpeed": 0.64,
    "airQualityLevel": "moderate",
    "airQualityIndex": 65,
    "reliability": 0.7,
    "CO": 500,
    "NO": 45,
    "NO2": 69,
    "NOx": 139,
    "SO2": 11,
    "CO_Level": "moderate",
    "refPointOfInterest": "null"
}'

6.Update the precipitation value of the same entity in Orion.

curl -X PATCH \
http://0.0.0.0:1026/v2/entities/air_quality_observer_be_001/attrs \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
    "precipitation": {
    "value": 100,
    "type": "Number"
    }
}'

7.Query the changed record of precipitation from quantumLeap for the same entity.

curl -X GET \
'http://0.0.0.0:8668/v2/entities/air_quality_observer_be_001/attrs/precipitation?type=AirQualityObserved' \
-H 'Accept: application/json'

Parts of docker-compose.yml:

orion:
    image: fiware/orion
    hostname: orion
    container_name: fiware-orion
    depends_on:
      - mongo-db
    expose:
      - "1026"
    ports:
      - "1026:1026"
    networks:
      - default
    command: -dbhost mongo-db -logLevel ERROR -corsOrigin __ALL
mongo-db:
    image: mongo:3.6
    hostname: mongo-db
    container_name: db-mongo
    expose:
      - "27017"
    ports:
      - "27017:27017"
    networks:
      - default
    command: --bind_ip_all --smallfiles
    volumes:
      - mongo-db:/data
cratedb:
    image: crate:3.1.2
    hostname: cratedb
    container_name: db-crate
    expose:
      - "4200"
      - "4300"
      - "5432"
    ports:
      - "4200:4200"
      - "4300:4300"
      - "5432:5432"
    networks:
      - default
    command: -Ccluster.name=democluster -Chttp.cors.enabled=true -Chttp.cors.allow-origin="*"
    volumes:
      - crate-db:/data
quantumleap:
    image: smartsdk/quantumleap
    hostname: quantumleap
    container_name: fiware-quantumleap
    expose:
      - "8668"
    ports:
      - "8668:8668"
    depends_on:
      - cratedb
    environment:
      - CRATE_HOST=cratedb # host name of CrateDB

NOT solved, but have a little clue.

I got some log from quantumLeap. There is a crate client in quantumLeap, and the reason may be that the crate client in quantumLeap is not working properly.

I paste the log here:

crate.client.exceptions.ProgrammingError: SQLActionException[ClusterBlockException: blocked by: [FORBIDDEN/12/index read-only / allow delete (api)];]
172.18.1.1 - - [04/May/2020 17:00:33] "POST /v2/notify HTTP/1.1" 500 -
INFO:werkzeug:172.18.1.1 - - [04/May/2020 17:00:33] "POST /v2/notify HTTP/1.1" 500 -
INFO:translators.factory:Backend selected for tenant 'iothouse' is: crate
ERROR:app:Exception on /v2/notify [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.6/site-packages/connexion/decorators/decorator.py", line 48, in wrapper
    response = function(request)
  File "/usr/local/lib/python3.6/site-packages/connexion/decorators/uri_parsing.py", line 143, in wrapper
    response = function(request)
  File "/usr/local/lib/python3.6/site-packages/connexion/decorators/validation.py", line 172, in wrapper
    response = function(request)
  File "/usr/local/lib/python3.6/site-packages/connexion/decorators/validation.py", line 347, in wrapper
    return function(request)
  File "/usr/local/lib/python3.6/site-packages/connexion/decorators/parameter.py", line 126, in wrapper
    return function(**kwargs)
  File "/src/ngsi-timeseries-api/src/reporter/reporter.py", line 189, in notify
    trans.insert(payload, fiware_s, fiware_sp)
  File "/src/ngsi-timeseries-api/src/translators/crate.py", line 189, in insert
    fiware_servicepath)
  File "/src/ngsi-timeseries-api/src/translators/crate.py", line 297, in _insert_entities_of_type
    self.cursor.executemany(stmt, entries)
  File "/usr/local/lib/python3.6/site-packages/crate/client/cursor.py", line 67, in executemany
    self.execute(sql, bulk_parameters=seq_of_parameters)
  File "/usr/local/lib/python3.6/site-packages/crate/client/cursor.py", line 54, in execute
    bulk_parameters)
  File "/usr/local/lib/python3.6/site-packages/crate/client/http.py", line 328, in sql
    content = self._json_request('POST', self.path, data=data)
  File "/usr/local/lib/python3.6/site-packages/crate/client/http.py", line 448, in _json_request
    _raise_for_status(response)
  File "/usr/local/lib/python3.6/site-packages/crate/client/http.py", line 187, in _raise_for_status
    error_trace=error_trace)

Solved. The root cause is at crateDB. When the hard disk exausted, the crateDB is down and every table are set with readonly. The read-only blocks are not automatically removed from the tables even after the disk space is freed and the threshold is undershot.

Everything is OK after I set the readonly flag to false with the following command in crateDB:

SHOW CREATE TABLE <tableName>;
ALTER TABLE <tableName> SET ("blocks.read_only_allow_delete" = FALSE);

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