本文介绍了当 ignite 在 Opendaylight apache karaf 中作为服务启动时,如何为 apache ignite 设置自定义 REST 端口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Opendaylight 使用端口 8080,这与默认的 ignite REST http 端口相同.因此,我尝试更改 ignite 侦听 REST 请求的端口.这是一个 Java 代码片段.

 System.setProperty("IGNITE_JETTY_PORT","7111");System.setProperty("IGNITE_JETTY_HOST","localhost");点燃 = Ignition.start(config);

当我在 eclipse 中运行时,上述工作正常并更改了 ignite REST 端口.但是当我在 apache karaf 中启动一个 ignite 实例时失败了.

解决方案

我觉得你可以试试ignite的配置

<property name="ConnectorConfiguration.jettyPath" value="config/ignite-rest.

在 ignite-rest.

<配置id="服务器"类="org.eclipse.jetty.server.Server"><Arg name="threadPool"><!-- 默认排队阻塞线程池--><New class="org.eclipse.jetty.util.thread.QueuedThreadPool"><Set name="minThreads">20</Set><Set name="maxThreads">200</Set></新的></Arg><New id="httpCfg" class="org.eclipse.jetty.server.HttpConfiguration"><Set name="secureScheme">https</Set><Set name="securePort">8443</Set><Set name="sendServerVersion">true</Set><Set name="sendDateHeader">true</Set></新的><呼叫名称="addConnector"><Arg><New class="org.eclipse.jetty.server.ServerConnector"><Arg name="server"><Ref refid="Server"/></Arg><Arg><数组类型="org.eclipse.jetty.server.ConnectionFactory"><物品><New class="org.eclipse.jetty.server.HttpConnectionFactory"><Ref refid="httpCfg"/></新的></项目></阵列></Arg><!--请注意,为了覆盖本地主机和端口值,系统属性必须具有名称 IGNITE_JETTY_HOST 和IGNITE_JETTY_PORT 相应地.--><Set name="host"><SystemProperty name="IGNITE_JETTY_HOST" default="localhost"/></Set><Set name="port"><SystemProperty name="IGNITE_JETTY_PORT" default="9090"/></Set><Set name="idleTimeout">30000</Set><Set name="reuseAddress">true</Set></新的></Arg></呼叫><New id="Handlers" class="org.eclipse.jetty.server.handler.HandlerCollection"><数组类型="org.eclipse.jetty.server.Handler"><物品><New id="Contexts" class="org.eclipse.jetty.server.handler.ContextHandlerCollection"/></项目></阵列></设置></新的></设置><Set name="stopAtShutdown">false</Set></配置>

您可以根据需要更改配置文件中的端口,

然后像这样开始点火:

ignite = Ignition.start(igniteConfigPath);

Opendaylight uses port 8080 which is the same as the default ignite REST http port. So i tried to change the port on which ignite listens for REST requests. Here is a java code snippet for this.

    System.setProperty("IGNITE_JETTY_PORT","7111");

    System.setProperty("IGNITE_JETTY_HOST","localhost");

    ignite = Ignition.start(config);

The above works fine and changes the ignite REST port when i run in eclipse. But fails when i start an ignite instance in apache karaf.

解决方案

I think you may try with the configuration

<property name="ConnectorConfiguration.jettyPath" value="config/ignite-rest.

and in the ignite-rest.

<?

You could change the port in the configuration file as you like,

and then start your ignite like:

ignite = Ignition.start(igniteConfigPath);

这篇关于当 ignite 在 Opendaylight apache karaf 中作为服务启动时,如何为 apache ignite 设置自定义 REST 端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 00:36
查看更多