1

我一直在从 MarkLogic 实例构建配置文件以通过 ml-gradle 进行部署。我想在 8003 完全禁用 REST 端点。我使用的是 ml-gradle 版本 2.7.0。我能够使用 gradle mlExportResources 收集我的大部分配置。

在我的 gradle.properties 中,我添加了

mlNoRestServer=true

我的 build.gradle 文件是

plugins {
  id "com.marklogic.ml-gradle" version "2.7.0"
  id "net.saliman.properties" version "1.4.6"
}
ext {
    mlAppConfig {
        modulesDatabaseName = "my-modules"
        contentDatabaseName = "my-documents"
        createTriggersDatabase = false
    }

    // Here's an example of not creating a REST API server at all - just remove the command
    mlAppDeployer.getCommands().remove(mlAppDeployer.getCommand("DeployRestApiServersCommand"))

}

部署看起来不错,直到它到达 REST 阶段。即使给出了配置,它仍然指的是端口 8003。

13:03:10.226 [INFO] [org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor] Initializing ExecutorService 
13:03:10.227 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Writing REST server configuration
13:03:10.227 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Default document read transform: null
13:03:10.227 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Transform all documents on read: false
13:03:10.228 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Validate query options: true
13:03:10.228 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Validate queries: true
13:03:10.228 [INFO] [com.marklogic.client.modulesloader.impl.DefaultModulesLoader] Output debugging: false
13:03:10.228 [INFO] [com.marklogic.client.impl.ServerConfigurationManagerImpl] Writing server configuration
13:03:10.229 [DEBUG] [com.marklogic.client.impl.JerseyServices] Putting config/properties/null
13:03:10.229 [DEBUG] [org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager] Get connection: {}->http://localhost:8003, timeout = 0
13:03:10.230 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] [{}->http://localhost:8003] total kept alive: 0, total issued: 0, total allocated: 0 out of 200
13:03:10.230 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] No free connections [{}->http://localhost:8003][null]
13:03:10.230 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Available capacity: 100 out of 100 [{}->http://localhost:8003][null]
13:03:10.231 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Creating new connection [{}->http://localhost:8003]
13:03:10.232 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnectionOperator] Connecting to localhost:8003
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection org.apache.http.impl.conn.DefaultClientConnection@9770e0c closed
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection org.apache.http.impl.conn.DefaultClientConnection@9770e0c shut down
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager] Released connection is not reusable.
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Releasing connection [{}->http://localhost:8003][null]
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.DefaultClientConnection] Connection org.apache.http.impl.conn.DefaultClientConnection@9770e0c closed
13:03:10.233 [DEBUG] [org.apache.http.impl.conn.tsccm.ConnPoolByRoute] Notifying no-one, there are no waiting threads
13:03:10.233 [INFO] [com.marklogic.client.impl.DatabaseClientImpl] Releasing connection
13:03:10.233 [DEBUG] [com.marklogic.client.impl.JerseyServices] Releasing connection
13:03:10.233 [DEBUG] [org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter] Removed task artifact state for {} from context.
13:03:10.233 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':mlDeployApp'
13:03:10.233 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] :mlDeployApp FAILED
13:03:10.234 [INFO] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] :mlDeployApp (Thread[Daemon worker Thread 11,5,main]) completed. Took 3 mins 12.831 secs.
13:03:10.234 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationWorkerRegistry] Worker root.3 completed (0 in use)
13:03:10.234 [DEBUG] [org.gradle.execution.taskgraph.AbstractTaskPlanExecutor] Task worker [Thread[Daemon worker Thread 11,5,main]] finished, busy: 3 mins 12.835 secs, idle: 0.002 secs
13:03:10.235 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] 
13:03:10.235 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.

为了不在端口 8003 上部署 REST 服务器,我缺少什么配置?

4

1 回答 1

1

从 2.7.0 开始,您现在可以在 gradle.properties 中设置 mlNoRestServer=true 以禁用 REST 服务器创建 - https://github.com/marklogic-community/ml-gradle/wiki/Property-reference

上面的错误是由于这些行:

13:03:10.228 [INFO] [com.marklogic.client.impl.ServerConfigurationManagerImpl] 编写服务器配置 13:03:10.229 [DEBUG] [com.marklogic.client.impl.JerseyServices] 放置 config/properties/null

你有 src/main/ml-modules/rest.properties 文件吗?如果是这样,ml-gradle 看到它并认为 - 我需要将它发送到 /v1/config/properties 以更新 REST API 服务器,但它不存在,并且错误结果。我的猜测是该文件存在;尝试删除它并再次运行 mlDeploy。

于 2017-05-20T16:36:12.713 回答