rest - 无法创建 marklogic rest api 实例
问题描述
我正在尝试使用以下配置创建 rest-api 实例:rest-api.json
{
"rest-api": {
"name": "restdb-api",
"database": "restdb",
"port": "8003",
"xdbc-enabled": true,
"forests-per-host": 1,
"error-format": "json"
}
}
curl --anyauth --user admin:admin -i -X POST -d @"./REST/rest-api.json" -H "Content-type: application/json" http://localhost:8002/LATEST/rest-apis
端点返回 201 created,但我无法在http://localhost:8003访问创建的端点。我曾尝试使用其他端口,但同样的事情正在发生。端口 8003 未在侦听。请帮我解决这个问题。
HTTP/1.1 401 Unauthorized
Server: MarkLogic
WWW-Authenticate: Digest realm="public", qop="auth", nonce="36473d01f5e45a:ND9/6NHD0sw9o2y/xad/uQ==", opaque="e9594a1b7e019a97"
Content-Type: text/html; charset=utf-8
Content-Length: 209
Connection: Keep-Alive
Keep-Alive: timeout=5
HTTP/1.1 201 Created
Server: MarkLogic
Content-Length: 0
Connection: Keep-Alive
Keep-Alive: timeout=5
解决方案
由于您说您在本地 docker 容器上运行,因此您可能需要发布端口。
请参阅 Docker公开
请从链接中注意 - “EXPOSE 指令实际上并没有发布端口。它充当构建图像的人和运行容器的人之间的一种文档类型,关于打算发布哪些端口。在运行容器时实际发布端口,使用 docker run 上的 -p 标志发布和映射一个或多个端口,或者 -P 标志发布所有暴露的端口并将它们映射到高位端口。”
希望有帮助!
推荐阅读
- wagtail - 鹡鸰更新后管理面板图标消失了
- java - 父类可以有一个字段,其泛型类型是当前后代的类型吗?
- python - 如何使用 Python 请求异步调用 aws lambda 函数
- c# - 是否可以在 c# 中将大量结构直接写入二进制文件?
- javascript - 在 create-react-app 中使用具有依赖关系的 webworkers
- django - 禁用prefers-color-scheme:django admin中的dark
- tensorflow - 调用 keras 模型作为函数
- javascript - React on conditions 中的多步表单
- java - ConcurrentHashMap.keySet().stream() 的一致性行为
- javascript - 我可以从 ReactJS 中的父元素中检索属性值吗?