微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Scalardb QA应用程序无法与Azure Cosmos DB一起正常使用 创建Cosmos数据库帐户质量检查后端应用程序设置设置前端应用程序

如何解决Scalardb QA应用程序无法与Azure Cosmos DB一起正常使用 创建Cosmos数据库帐户质量检查后端应用程序设置设置前端应用程序

我尝试使用Azure Cosmos DB启动scalardb后端QA application。 Spring启动应用程序显示为已启动。但是我无法使用端口8090访问质量检查后端应用程序。端口8090不在侦听端口import numpy as np import itertools import timeit import matplotlib.pyplot as plt def itertools1(m): x = list(itertools.combinations(np.arange(1,m+1),2)) np.prod(x,-1) def numpy1(m): n = m-1 x = np.triu(np.ones([n,n])) np.prod(np.argwhere(x)+np.arange(1,3),-1) def numpy2(m): np.multiply(*np.add(np.triu_indices(m,1),1)) def benchmark_time(m): SETUP_CODE = ''' from __main__ import numpy1 from __main__ import numpy2 from __main__ import itertools1 ''' x = np.zeros([3,len(m)]) for ind,m in enumerate(m): print('For m = {}'.format(m)) TEST_CODE = ''' itertools1({}) '''.format(m) # timeit.repeat statement times = timeit.repeat(setup = SETUP_CODE,stmt = TEST_CODE,repeat = 10,number = 50) x[0,ind] = np.average(times) print('Itertools1 give:\t{} s'.format(np.round(np.average(times),3))) TEST_CODE = ''' numpy1({}) '''.format(m) times = timeit.repeat(setup = SETUP_CODE,number = 50) x[1,ind] = np.average(times) print('Numpy1 give:\t\t{} s'.format(np.round(np.average(times),3))) TEST_CODE = ''' numpy2({}) '''.format(m) times = timeit.repeat(setup = SETUP_CODE,number = 50) x[2,ind] = np.average(times) print('Numpy2 give:\t\t{} s\n'.format(np.round(np.average(times),3))) return x m = np.arange(10,150,10) x = benchmark_time(m) plt.plot(m,x.T) plt.legend(('itertools','numpy triu','numpy triu_indices')) plt.xlabel('m') plt.ylabel('sec') plt.show() 中列出。

质量检查后端应用程序

QA backend application

当我们将其与质量检查前端应用程序连接时,它会显示错误消息lsof -i -P -n | grep LISTEN

质量检查前端应用程序

enter image description here

复制步骤

创建Cosmos数据库帐户

  1. 使用An error occurred during the login API创建一个Azure Cosmos数据库帐户。
  2. 将“认一致性”更改为Core (sql)
  3. 使用Schema Tool for Scalar DB
  4. 创建架构

schema.json

STRONG 

质量检查后端应用程序设置

  1. 来自QA application的应用程序克隆
  2. 使用cosmos db详细信息更新scalardb.properties(后端/QA/src/main/resources/scalardb.properties)文件

scalardb.properties

  "qa.question": {
    "transaction": false,"partition-key": [
      "date"
    ],"clustering-key": [
      "created_at"
    ],"columns": {
      "date": "TEXT","created_at": "BIGINT","title": "TEXT","user": "TEXT","context": "TEXT","updated_at": "BIGINT","number_of_answers": "INT"
    },"ru": 400
  },"qa.answer": {
    "transaction": false,"partition-key": [
      "question_created_at"
    ],"columns": {
      "question_created_at": "BIGINT","created_at": "BIGINT"
    },"qa.account": {
    "transaction": false,"partition-key": [
      "email"
    ],"clustering-key": [],"columns": {
      "email": "TEXT","password": "TEXT"
    },"qa.firstQuestionDate": {
    "transaction": false,"partition-key": [
      "id"
    ],"columns": {
      "id": "TEXT","first_question_date": "TEXT"
    },"ru": 400
  }
}
  1. 使用最新版本(2.2.0)更新scalardb依赖项

build.gradle

# Comma separated contact points
scalar.db.contact_points=<Cosmos DB URI>

# Port number for all the contact points. Default port number for each database is used if empty.
#scalar.db.contact_port=

# Credential information to access the database
scalar.db.username=
scalar.db.password=<PRIMARY KEY>

# Storage implementation. Either cassandra or cosmos can be set. Default storage is cassandra.
scalar.db.storage=cosmos
  1. 执行.... dependencies { //Scalar DB library compile group: 'com.scalar-labs',name: 'scalardb',version: '2.2.0' //Spring dependencies compile("org.springframework.boot:spring-boot-starter-web:${springBootVersion}") { exclude(group: 'ch.qos.logback') } compile("org.springframework.boot:spring-boot-starter:${springBootVersion}") { exclude(group: 'ch.qos.logback') } //Spring security layer for authentication compile("org.springframework.boot:spring-boot-starter-security:${springBootVersion}") { exclude(group: 'ch.qos.logback') } //Handle Json Web Token authentication compile group: 'io.jsonwebtoken',name: 'jjwt',version: '0.9.1' testCompile group: 'org.springframework.boot',name: 'spring-boot-starter-test',version: "${springBootVersion}" }
  2. 使用export SPRING_PROFILES_ACTIVE="storage"命令启动后端质量检查应用程序。

设置前端应用程序

  1. 转到sh gradlew bootRun
  2. 执行/frontend命令。
  3. 在浏览器make中打开质量检查应用程序。

当我们尝试登录时,质量检查前端应用程序会显示一条错误消息http://localhost:8080/#/login

质量检查后端应用程序不是从端口8090开始的。

有人解决了这个问题吗?您可以提出一些解决此问题的建议吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。