Giter Club home page Giter Club logo

microsoft / smartkg Goto Github PK

View Code? Open in Web Editor NEW
384.0 11.0 75.0 500.34 MB

This project accepts excel files as input which contains the description of a Knowledge Graph (Vertexes and Edges) and convert it into an in-memory Graph Store. This project implements APIs to search/filter/get nodes and relations from the in-memory Knowledge Graph. This project also provides a dialog management framework and enable a chatbot based on its knowledge graph.

License: MIT License

C# 66.49% Python 13.13% JavaScript 0.42% HTML 8.16% Vue 8.53% CSS 2.96% Dockerfile 0.31%

smartkg's Introduction

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Usage

SmartKG是一款轻量级知识图谱可视化+智能对话框架。它能够根据用户输入的实体和关系数据自动生成知识图谱,并提供图谱可视化及基于图谱的智能对话机器人。

0. 更加详细的安装、编译和使用方法请见:https://github.com/microsoft/SmartKG/blob/master/SmartKG_Spec.pdf

1. 下载 SmartKG

1.1 下载安装下列软件:

(1) git: https://gitforwindows.org/
(2) .NET Core 2.1 运行时环境	
(3) Node.JS: https://nodejs.org/zh-cn/download/ (推荐 14.15.4)
(4) 如果要改写或重新编译源代码,还需要安装 Visual Studio 2019: https://visualstudio.microsoft.com/zh-hans/downloads/ 

1.2 Clone Repositry

(1) 进入 ${SourceCode_Base_Path}
(2) 运行:
	git clone https://github.com/microsoft/SmartKG

1.3 目录结构

在目录dockers里,是已经编译好前后端服务的二进制码、配置文件,以及对应的docker image。

在目录Resources里,有用户上传数据的模板和用来做测试的图谱数据。其中,template子目录中是模板,用户如果要创建自己的知识图谱,就需要按照模板的格式要求,填入相应实体和实体关系。Input子目录内有包括西游记、红楼梦、中学物理课以及COVID19等数据。

在目录SmartKGLocalBase里,是SmartKG后端服务会调用的一些Python文件和用于存储运行时数据的本地文件的目录。

在目录SmartKGUI下面,是SmartKG UI的源代码。是基于Node.js, 用JavaScript开发的。

在目录src下面,是SmartKG后端服务的源代码。这部分源代码是基于Asp.NET 框架,用C# 开发的。

2. 运行SmartKG

2.1 Windows 上运行 SmartKG

(1) 在Windows环境里启动 SmartKG,首先应该新建一个目录,例如,我们创建一个名为 temp 的目录。然后,从本地 Repo 中dockers目录内的smartkg子目录中,将两个zip文件和local_config文件夹复制到temp文件夹中。还需要从dockers目录的ui 子目录中,将唯一一个zip文件和local_config文件夹复制到temp文件夹中。

(2) 把temp目录中的三个压缩文件直接就地解压缩(Extraction Here)。

(3) 并将temp/local_config中的config.js移动到解压缩后的 temp/smartkgui/public中。

(4) 将local_confing的appsettings.File.json文件复制一份,并改名为appsettings.json,移动到temp/smartkg中。

(5) 【启动后端】
    命令行进入 temp/smartkg,运行命令:dotnet SmartKG.KGBot.dll
    此命令用于启动 SmartKG 后端。启动后,会生成一个Now listening on地址,我们直接访问地址就可以。在浏览器中输入地址 http://localhost:5000/swagger/index.html,可以访问后,说明后台启动成功了。

    *注意:后端启动成功后不要关闭,在使用SmartKG的整个过程中,前后端都要保持打开状态。*

(6) 【启动前端】
    进入temp/smartkgui目录下,输入命令:
	npm i
    这个命令只需要第一次使用时运行,如果已经运行过,就可以跳过了。

    此命令运行成功后,再输入命令:
	npm run serve

    运行成功后,会给一个访问地址,例如:http://localhost:8080/
        用这个地址就可以直接在浏览器中访问 SmartKG 的主界面了,这个地址加上 "/upload" 是 SmartKG 的上传页面。

2.2 Linux 上运行 SmartKG

(0) 在Linux环境部署前,需要提前安装好 docker 和 docker-compose。

(1) 打开 Repo 中的 dockers 目录,将里面的 smartkg_services 目录整体压缩,并拷贝到Linux机器上,一般放在用户目录下。

(2) 在 Linux 系统进入用户目录,并解压缩 smartkg_services.zip。

(3) 进入 smartkg_services/ 目录,运行下列命令启动 SmartKG docker-compose OneBox
            注:需要先修改docker-compose.yml中的MONGO_INITDB_ROOT_USERNAME及MONGO_INITDB_ROOT_PASSWORD的值,并修改smartkg/appsetting.json中MongoDbConnection的MONGO_INITDB_ROOT_USERNAME及MONGO_INITDB_ROOT_PASSWORD对应docker-compose.yml中的值

	1) sudo docker-compose build --build-arg DOCKER_HOST=${docker_host_ip}
	2) sudo docker-compose up

     访问后端:http://${docker_host_ip}:8082/swagger/index.html 能够获得 API 列表

         访问前端:http://${docker_host_ip}:8083 主页面
                   http://${docker_host_ip}:8083/upload 上传页面

3. 生成自己的图谱

3.1 填写模板

(1) 模板位于 ${SourceCode_Base_Path}/SmartKG/Resources/_Template/SmartKG_KGDesc_Template.xlsx
(2) 模板分为两页:顶点页和边页。前者为图谱中的实体,后者为实体间的关系。根据模板样例填写你自己的顶点和边数据。	
(3) 做测试,建议使用 ${SourceCode_Base_Path}/SmartKG/Resources/Data/Excel/input/XYJ/SmartKG_Xiyouji_relations_new.xlsx

3.2 将填写好的 excel 文件通过 SmartKG 的前端 upload 页面上传

4. 编译 SmartKG

4.1 用 Visual Studio 2019 编译 SmartKG

回到Repo目录,进入src文件夹,启动SmartKG.sln。
进入到VS后,点击Build的Bulid Solution,编译源代码。

4.2 Publish SmartKG

在 Visual Studio 中打开 SmartKG solution 后,右键点击 SmartKG.KGBot project,选择点击 Publish,接着点击 Folder,以及 Next。

配置 Publish 选项:

	配置:Release
	目标框架:netcoreapp2.1.16
	目标运行时:可移植的

保存设置后直接 Publish!

smartkg's People

Contributors

chenqingot avatar juliali avatar microsoft-github-operations[bot] avatar microsoftopensource avatar sssuyx avatar yejuliali avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

smartkg's Issues

问答部分

我根据它自带的数据库提问时总是显示无法识别意图

There always report errors when build service "smartkg"

It can be seen from the Docker-compose file that the application contains three services, namely aspnetcore, smartkg, and ui. When I execute "sudo docker-compose build --build-arg DOCKER_HOST=${docker_host_ip}" , there always report errors about smartkg as follows,
=> ERROR [smartkg internal] load metadata for docker.io/library/aspnetcore:latest 48.0s
failed to solve: DeadlineExceeded: DeadlineExceeded: DeadlineExceeded: aspnetcore: failed to do request: Head "https://registry.docker-cn.com/v2/library/aspnetcore/manifests/latest?ns=docker.io": dial tcp 106.14.52.175:443: i/o timeout

It seems that the image 'docker.io/library/aspnetcore:latest' can not be accessed,

Can you help me fix this issue?

请更新下Dockerfile

FROM python36这个"python36"在docker hub中找不到了;
FROM node最新版会有问题;

std::exception::what(): Operation not permitted\nActual exception type: std::system_error

smartkg_services-mongo-1 exited with code 14

"Initialized wire specification","attr":{"spec":{"incomingExternalClient":{"minWireVersion":0,"maxWireVersion":21},"incomingInternalClient":{"minWireVersion":0,"maxWireVersion":21},"outgoing":{"minWireVersion":6,"maxWireVersion":21},"isInternalClient":true}}}
"Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'"}
"Implicit TCP FastOpen unavailable. If TCP FastOpen is required, set tcpFastOpenServer, tcpFastOpenClient, and tcpFastOpenQueueSize."}
"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationDonorService","namespace":"config.tenantMigrationDonors"}}
"Successfully registered PrimaryOnlyService","attr":{"service":"TenantMigrationRecipientService","namespace":"config.tenantMigrationRecipients"}}
"Multi threading initialized"}
"Writing fatal message","attr":{"message":"terminate() called. An exception is active; attempting to gather more information\n"}}
"Writing fatal message","attr":{"message":"std::exception::what(): Operation not permitted\nActual exception type: std::system_error\n\n"}}
"Writing fatal message","attr":{"message":"\n"}}
"BACKTRACE","attr":{"bt":{"backtrace":[{"a":"56259E011E78","b":"5625965DD000","o":"7A34E78","s":"_ZN5mongo15printStackTraceEv","C":"mongo::printStackTrace()","s+":"38"},{"a":"56259E00D29B","b":"5625965DD000","o":"7A3029B","s":"_ZN5mongo12_GLOBAL__N_111myTerminateEv","C":"mongo::(anonymous namespace)::myTerminate()","s+":"DB"},{"a":"56259E1B4CDA","b":"5625965DD000","o":"7BD7CDA","s":"_ZN10__cxxabiv111__terminateEPFvvE","C":"__cxxabiv1::__terminate(void ()())","s+":"A"},{"a":"56259E1B4D45","b":"5625965DD000","o":"7BD7D45","s":"_ZSt9terminatev","C":"std::terminate()","s+":"15"},{"a":"56259E1B4E99","b":"5625965DD000","o":"7BD7E99","s":"__cxa_throw","s+":"49"},{"a":"56259E23AC65","b":"5625965DD000","o":"7C5DC65","s":"_ZSt20__throw_system_errori","C":"std::__throw_system_error(int)","s+":"88"},{"a":"56259E23AEDD","b":"5625965DD000","o":"7C5DEDD","s":"_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE","C":"std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void ()())","s+":"2D"},{"a":"56259B3F9ACC","b":"5625965DD000","o":"4E1CACC","s":"_ZN5mongo27startSignalProcessingThreadENS_13LogFileStatusE","C":"mongo::startSignalProcessingThread(mongo::LogFileStatus)","s+":"11C"},{"a":"56259A007B81","b":"5625965DD000","o":"3A2AB81","s":"_ZN5mongo11mongod_mainEiPPc","C":"mongo::mongod_main(int, char**)","s+":"1001"},{"a":"562599FFFDF5","b":"5625965DD000","o":"3A22DF5","s":"main","s+":"C"},{"a":"7FF268815D90","b":"7FF2687EC000","o":"29D90","s":"__libc_init_first","s+":"90"},{"a":"7FF268815E40","b":"7FF2687EC000","o":"29E40","s":"__libc_start_main","s+":"80"},{"a":"562599FFFD25","b":"5625965DD000","o":"3A22D25","s":"_start","s+":"25"}],"processInfo":{"mongodbVersion":"7.0.5","gitVersion":"7809d71e84e314b497f282ea8aa06d7ded3eb205","compiledModules":[],"uname":{"sysname":"Linux","release":"5.4.0-150-generic","version":"#167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023","machine":"x86_64"},"somap":[{"b":"5625965DD000","elfType":3,"buildId":"1E37CC781EB07208"},{"b":"7FF2687EC000","path":"/lib/x86_64-linux-gnu/libc.so.6","elfType":3,"buildId":"C289DA5071A3399DE893D2AF81D6A30C62646E1E"}]}}},"tags":[]}
"Frame","attr":{"frame":{"a":"56259E011E78","b":"5625965DD000","o":"7A34E78","s":"_ZN5mongo15printStackTraceEv","C":"mongo::printStackTrace()","s+":"38"}}}
"Frame","attr":{"frame":{"a":"56259E00D29B","b":"5625965DD000","o":"7A3029B","s":"_ZN5mongo12_GLOBAL__N_111myTerminateEv","C":"mongo::(anonymous namespace)::myTerminate()","s+":"DB"}}}
"Frame","attr":{"frame":{"a":"56259E1B4CDA","b":"5625965DD000","o":"7BD7CDA","s":"_ZN10__cxxabiv111__terminateEPFvvE","C":"__cxxabiv1::__terminate(void ()())","s+":"A"}}}
"Frame","attr":{"frame":{"a":"56259E1B4D45","b":"5625965DD000","o":"7BD7D45","s":"_ZSt9terminatev","C":"std::terminate()","s+":"15"}}}
"Frame","attr":{"frame":{"a":"56259E1B4E99","b":"5625965DD000","o":"7BD7E99","s":"__cxa_throw","s+":"49"}}}
"Frame","attr":{"frame":{"a":"56259E23AC65","b":"5625965DD000","o":"7C5DC65","s":"_ZSt20__throw_system_errori","C":"std::__throw_system_error(int)","s+":"88"}}}
"Frame","attr":{"frame":{"a":"56259E23AEDD","b":"5625965DD000","o":"7C5DEDD","s":"_ZNSt6thread15_M_start_threadESt10unique_ptrINS_6_StateESt14default_deleteIS1_EEPFvvE","C":"std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_deletestd::thread::_State >, void (
)())","s+":"2D"}}}
"Frame","attr":{"frame":{"a":"56259B3F9ACC","b":"5625965DD000","o":"4E1CACC","s":"_ZN5mongo27startSignalProcessingThreadENS_13LogFileStatusE","C":"mongo::startSignalProcessingThread(mongo::LogFileStatus)","s+":"11C"}}}
"Frame","attr":{"frame":{"a":"56259A007B81","b":"5625965DD000","o":"3A2AB81","s":"_ZN5mongo11mongod_mainEiPPc","C":"mongo::mongod_main(int, char**)","s+":"1001"}}}
"Frame","attr":{"frame":{"a":"562599FFFDF5","b":"5625965DD000","o":"3A22DF5","s":"main","s+":"C"}}}
"Frame","attr":{"frame":{"a":"7FF268815D90","b":"7FF2687EC000","o":"29D90","s":"__libc_init_first","s+":"90"}}}
"Frame","attr":{"frame":{"a":"7FF268815E40","b":"7FF2687EC000","o":"29E40","s":"__libc_start_main","s+":"80"}}}
"Frame","attr":{"frame":{"a":"562599FFFD25","b":"5625965DD000","o":"3A22D25","s":"_start","s+":"25"}}}
smartkg_services-smartkg-1 | Aborted (core dumped)
smartkg_services-smartkg-1 exited with code 134
smartkg_services-mongo-1 exited with code 14

404 error

(base) PS D:\新奥工作\中台工作\知识图谱\如何半自动、自动生成知识图谱\temp\smartkg> dotnet .\SmartKG.KGBot.dll
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
User profile is available. Using 'C:\Users\maguolianga\AppData\Local\ASP.NET\DataProtection-Keys' as key repository and Windows DPAPI to encrypt keys at rest.
Knowledge Graph is parsed.
NLU materials is parsed.
Knowledge Graph is parsed.
NLU materials is parsed.
Knowledge Graph is parsed.
NLU materials is parsed.
Knowledge Graph is parsed.
NLU materials is parsed.
Knowledge Graph is parsed.
NLU materials is parsed.
Knowledge Graph is parsed.
NLU materials is parsed.
Hosting environment: Production
Content root path: D:\新奥工作\中台工作\知识图谱\如何半自动、自动生成知识图谱\temp\smartkg
Now listening on: http://localhost:5000
Application started. Press Ctrl+C to shut down.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/
warn: Microsoft.AspNetCore.HttpsPolicy.HttpsRedirectionMiddleware[3]
Failed to determine the https port for redirect.
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 326.2834ms 404
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.9412ms 404
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
Request starting HTTP/1.1 GET http://localhost:5000/
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
Request finished in 0.5543ms 404

When I run dotnet .\SmartKG.KGBot.dll I get a 404 error, Why does this happen? There should be no problem with configuring the environment.

后端监听端口修改

我有一个程序监听的也是5000端口,产生了冲突。希望修改smartkg的后端程序的监听端口号,5000变为5006,没有找到修改的位置。
`修改launchsettings.json中的

"SmartKG.KGManagement": {
      "commandName": "Project",
      "launchBrowser": true,
      "launchUrl": "weatherforecast",
      "applicationUrl": "https://localhost:5001;http://localhost:5000",
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Development"
      }
    }

不起作用

LLM按钮无法激活

在data目录下提供openai_key.txt文件后,重新启动app,还是无法激活在dialog中的LLM按钮。

无法新建数据库

所有的内容都搞好了。服务端和前端也都搭建好了。没有报错。
但upload页面新建数据库,无法新建
看了一下服务端的报错。

image

Connection id "0HMP2QQ2UVSTB", Request id "0HMP2QQ2UVSTB:00000021": the application completed without reading the entire request body.

前端界面点击卡死的问题

情况:

  • 点击一个单位时有概率会出现下图卡死的情况

环境:

  • Windows 10
  • Chrome 版本 85.0.4183.121(正式版本) (64 位)

解决:

对前端代码——SmartKG/SmartKGUI/src/views/ 中两个 .vue 文件中的方法用 asyncawait 方式改写,后续拿到数据后重新渲染界面时注意使用 vm.$set() 方式重新赋值。

可以参考这里的文档:《检测变化的注意事项》

以后有机会我可以提一个 PR,我的邮箱:[email protected]

The connection string 'mongodb://MONGO_INITDB_ROOT_USERNAME:MONGO_INITDB_ROOT_PASSWORD@:27000' is not valid.

smartkg_services-smartkg-1     | Application startup exception: MongoDB.Driver.MongoConfigurationException: The connection string 'mongodb://MONGO_INITDB_ROOT_USERNAME:MONGO_INITDB_ROOT_PASSWORD@:27000' is not valid.
smartkg_services-smartkg-1     |    at MongoDB.Driver.Core.Configuration.ConnectionString.Parse()
smartkg_services-smartkg-1     |    at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString)
smartkg_services-smartkg-1     |    at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
smartkg_services-smartkg-1     |    at MongoDB.Driver.MongoUrl..ctor(String url)
smartkg_services-smartkg-1     |    at SmartKG.Common.DataPersistance.MongoDataAccessor..ctor(String connectionString, String mgmtDatabaseName) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\MongoDataAccessor.cs:line 35
smartkg_services-smartkg-1     |    at SmartKG.Common.DataPersistence.DataLoader..ctor(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\DataLoader.cs:line 48
smartkg_services-smartkg-1     |    at SmartKG.Common.DataStoreMgmt.DataStoreManager..ctor(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 32
smartkg_services-smartkg-1     |    at SmartKG.Common.DataStoreMgmt.DataStoreManager.initInstance(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 39
smartkg_services-smartkg-1     |    at SmartKG.KGBot.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger`1 _log) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Startup.cs:line 56
smartkg_services-smartkg-1     | --- End of stack trace from previous location where exception was thrown ---
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
smartkg_services-smartkg-1     | crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
smartkg_services-smartkg-1     |       Application startup exception
smartkg_services-smartkg-1     | MongoDB.Driver.MongoConfigurationException: The connection string 'mongodb://MONGO_INITDB_ROOT_USERNAME:MONGO_INITDB_ROOT_PASSWORD@:27000' is not valid.
smartkg_services-smartkg-1     |    at MongoDB.Driver.Core.Configuration.ConnectionString.Parse()
smartkg_services-smartkg-1     |    at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString)
smartkg_services-smartkg-1     |    at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
smartkg_services-smartkg-1     |    at MongoDB.Driver.MongoUrl..ctor(String url)
smartkg_services-smartkg-1     |    at SmartKG.Common.DataPersistance.MongoDataAccessor..ctor(String connectionString, String mgmtDatabaseName) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\MongoDataAccessor.cs:line 35
smartkg_services-smartkg-1     |    at SmartKG.Common.DataPersistence.DataLoader..ctor(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\DataLoader.cs:line 48
smartkg_services-smartkg-1     |    at SmartKG.Common.DataStoreMgmt.DataStoreManager..ctor(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 32
smartkg_services-smartkg-1     |    at SmartKG.Common.DataStoreMgmt.DataStoreManager.initInstance(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 39
smartkg_services-smartkg-1     |    at SmartKG.KGBot.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger`1 _log) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Startup.cs:line 56
smartkg_services-smartkg-1     | --- End of stack trace from previous location where exception was thrown ---
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
smartkg_services-smartkg-1     |
smartkg_services-smartkg-1     | Unhandled Exception: MongoDB.Driver.MongoConfigurationException: The connection string 'mongodb://MONGO_INITDB_ROOT_USERNAME:MONGO_INITDB_ROOT_PASSWORD@:27000' is not valid.
smartkg_services-smartkg-1     |    at MongoDB.Driver.Core.Configuration.ConnectionString.Parse()
smartkg_services-smartkg-1     |    at MongoDB.Driver.Core.Configuration.ConnectionString..ctor(String connectionString)
smartkg_services-smartkg-1     |    at MongoDB.Driver.MongoUrlBuilder.Parse(String url)
smartkg_services-smartkg-1     |    at MongoDB.Driver.MongoUrl..ctor(String url)
smartkg_services-smartkg-1     |    at SmartKG.Common.DataPersistance.MongoDataAccessor..ctor(String connectionString, String mgmtDatabaseName) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\MongoDataAccessor.cs:line 35
smartkg_services-smartkg-1     |    at SmartKG.Common.DataPersistence.DataLoader..ctor(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\DataLoader.cs:line 48
smartkg_services-smartkg-1     |    at SmartKG.Common.DataStoreMgmt.DataStoreManager..ctor(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 32
smartkg_services-smartkg-1     |    at SmartKG.Common.DataStoreMgmt.DataStoreManager.initInstance(IConfiguration config) in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 39
smartkg_services-smartkg-1     |    at SmartKG.KGBot.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger`1 _log) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Startup.cs:line 56
smartkg_services-smartkg-1     | --- End of stack trace from previous location where exception was thrown ---
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
smartkg_services-smartkg-1     |    at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
smartkg_services-smartkg-1     |    at SmartKG.KGBot.Program.Main(String[] args) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Program.cs:line 14
smartkg_services-mongo-1 exited with code 1
smartkg_services-smartkg-1     | Aborted (core dumped)
smartkg_services-smartkg-1 exited with code 134

macos onebox 启动,DOCKER_HOST=127.0.0.1, smart_kg service 连接数据库失败

docker-compose build --build-arg DOCKER_HOST=127.0.0.1

smart kg service log
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
      User profile is available. Using '/root/.aspnet/DataProtection-Keys' as key repository; keys will not be encrypted at rest.
info: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[58]
      Creating key {78670271-8adc-4f8c-9f69-7db206d97b8e} with creation date 2022-01-21 07:57:39Z, activation date 2022-01-21 07:57:39Z, and expiration date 2022-04-21 07:57:39Z.
warn: Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[35]
      No XML encryptor configured. Key {78670271-8adc-4f8c-9f69-7db206d97b8e} may be persisted to storage in unencrypted form.
info: Microsoft.AspNetCore.DataProtection.Repositories.FileSystemXmlRepository[39]
      Writing data to file '/root/.aspnet/DataProtection-Keys/key-78670271-8adc-4f8c-9f69-7db206d97b8e.xml'.
Application startup exception: System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "127.0.0.1:27000" }", EndPoint: "127.0.0.1:27000", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: Connection refused 127.0.0.1:27000
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.<>c.b__271_0(IAsyncResult iar)
--- End of stack trace from previous location where exception was thrown ---
   at MongoDB.Driver.Core.Connections.TcpStreamFactory.ConnectAsync(Socket socket, EndPoint endPoint, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)", LastUpdateTimestamp: "2022-01-21T07:58:10.7580197Z" }] }.
   at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSession[TResult](Func2 func, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.FindSync[TProjection](FilterDefinition1 filter, FindOptions2 options, CancellationToken cancellationToken)    at MongoDB.Driver.FindFluent2.ToCursor(CancellationToken cancellationToken)
   at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListTDocument
   at SmartKG.Common.DataPersistance.MongoDataAccessor.GetDataStoreList() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\MongoDataAccessor.cs:line 156
   at SmartKG.Common.DataPersistence.DataLoader.Load() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\DataLoader.cs:line 56
   at SmartKG.Common.DataStoreMgmt.DataStoreManager.LoadDataStores() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 72
   at SmartKG.KGBot.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger1 _log) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Startup.cs:line 73 --- End of stack trace from previous location where exception was thrown ---    at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)    at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() crit: Microsoft.AspNetCore.Hosting.Internal.WebHost[6]       Application startup exception System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "127.0.0.1:27000" }", EndPoint: "127.0.0.1:27000", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: Connection refused 127.0.0.1:27000    at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)    at System.Net.Sockets.Socket.<>c.<ConnectAsync>b__271_0(IAsyncResult iar) --- End of stack trace from previous location where exception was thrown ---    at MongoDB.Driver.Core.Connections.TcpStreamFactory.ConnectAsync(Socket socket, EndPoint endPoint, CancellationToken cancellationToken)    at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)    --- End of inner exception stack trace ---    at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)    at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)", LastUpdateTimestamp: "2022-01-21T07:58:10.7580197Z" }] }.    at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)    at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)    at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)    at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)    at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)    at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)    at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSessionTResult
   at MongoDB.Driver.MongoCollectionImpl1.FindSync[TProjection](FilterDefinition1 filter, FindOptions2 options, CancellationToken cancellationToken)    at MongoDB.Driver.FindFluent2.ToCursor(CancellationToken cancellationToken)
   at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListTDocument
   at SmartKG.Common.DataPersistance.MongoDataAccessor.GetDataStoreList() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\MongoDataAccessor.cs:line 156
   at SmartKG.Common.DataPersistence.DataLoader.Load() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\DataLoader.cs:line 56
   at SmartKG.Common.DataStoreMgmt.DataStoreManager.LoadDataStores() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 72
   at SmartKG.KGBot.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger`1 _log) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Startup.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Unhandled Exception: System.TimeoutException: A timeout occured after 30000ms selecting a server using CompositeServerSelector{ Selectors = MongoDB.Driver.MongoClient+AreSessionsSupportedServerSelector, LatencyLimitingServerSelector{ AllowedLatencyRange = 00:00:00.0150000 } }. Client view of cluster state is { ClusterId : "1", ConnectionMode : "Automatic", Type : "Unknown", State : "Disconnected", Servers : [{ ServerId: "{ ClusterId : 1, EndPoint : "127.0.0.1:27000" }", EndPoint: "127.0.0.1:27000", State: "Disconnected", Type: "Unknown", HeartbeatException: "MongoDB.Driver.MongoConnectionException: An exception occurred while opening a connection to the server. ---> System.Net.Internals.SocketExceptionFactory+ExtendedSocketException: Connection refused 127.0.0.1:27000
   at System.Net.Sockets.Socket.EndConnect(IAsyncResult asyncResult)
   at System.Net.Sockets.Socket.<>c.b__271_0(IAsyncResult iar)
--- End of stack trace from previous location where exception was thrown ---
   at MongoDB.Driver.Core.Connections.TcpStreamFactory.ConnectAsync(Socket socket, EndPoint endPoint, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Connections.TcpStreamFactory.CreateStreamAsync(EndPoint endPoint, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at MongoDB.Driver.Core.Connections.BinaryConnection.OpenHelperAsync(CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.ServerMonitor.HeartbeatAsync(CancellationToken cancellationToken)", LastUpdateTimestamp: "2022-01-21T07:58:10.7580197Z" }] }.
   at MongoDB.Driver.Core.Clusters.Cluster.ThrowTimeoutException(IServerSelector selector, ClusterDescription description)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChangedHelper.HandleCompletedTask(Task completedTask)
   at MongoDB.Driver.Core.Clusters.Cluster.WaitForDescriptionChanged(IServerSelector selector, ClusterDescription description, Task descriptionChangedTask, TimeSpan timeout, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Clusters.Cluster.SelectServer(IServerSelector selector, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupportedAfterServerSelection(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoClient.AreSessionsSupported(CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.StartImplicitSession(CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSession[TResult](Func2 func, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.FindSync[TProjection](FilterDefinition1 filter, FindOptions2 options, CancellationToken cancellationToken)    at MongoDB.Driver.FindFluent2.ToCursor(CancellationToken cancellationToken)
   at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListTDocument
   at SmartKG.Common.DataPersistance.MongoDataAccessor.GetDataStoreList() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\MongoDataAccessor.cs:line 156
   at SmartKG.Common.DataPersistence.DataLoader.Load() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataPersistance\DataLoader.cs:line 56
   at SmartKG.Common.DataStoreMgmt.DataStoreManager.LoadDataStores() in C:\Users\jull\source\github\SmartKG\src\SmartKG.Common\DataStoreMgmt\DataStoreManager.cs:line 72
   at SmartKG.KGBot.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, ILogger`1 _log) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Startup.cs:line 73
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.StartAsync(CancellationToken cancellationToken)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token, String shutdownMessage)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host, CancellationToken token)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at SmartKG.KGBot.Program.Main(String[] args) in C:\Users\jull\source\github\SmartKG\src\SmartKG.KGBot\Program.cs:line 14
Aborted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.