使用Ignite点火-应用程序继续运行

时间:2018-10-23 09:32:42

标签: apache-spark ignite

我正在尝试在Spark应用程序中对Ignite进行写入/读取。读写似乎都可以正常工作,但是即使应用程序完成了必须要做的工作,它也不会结束。

特别是日志继续打印相同的行:

2018-10-23 09:08:12 DEBUG GridCachePartitionExchangeManager:558 - Before waiting for exchange futures [futs[], worker=GridWorker [name=partition-exchanger, igniteInstanceName=null, finished=false, hashCode=215498915, interrupted=false, runner=exchange-worker-#35]]
2018-10-23 09:08:12 DEBUG GridTimeoutProcessor:558 - Timeout has occurred [obj=CancelableTask [id=2374d20a661-967c7da2-84ed-46d9-9ec1-fd64ab02e16a, endTime=1540285692400, period=2000, cancel=false, task=org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$13@2e49ebc1], process=true]
2018-10-23 09:08:14 DEBUG GridTimeoutProcessor:558 - Timeout has occurred [obj=CancelableTask [id=3374d20a661-967c7da2-84ed-46d9-9ec1-fd64ab02e16a, endTime=1540285694375, period=3000, cancel=false, task=org.apache.ignite.internal.processors.query.GridQueryProcessor$2@579e2347], process=true]
2018-10-23 09:08:14 DEBUG GridTimeoutProcessor:558 - Timeout has occurred [obj=CancelableTask [id=2374d20a661-967c7da2-84ed-46d9-9ec1-fd64ab02e16a, endTime=1540285694400, period=2000, cancel=false, task=org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$13@2e49ebc1], process=true]
2018-10-23 09:08:14 DEBUG GridTimeoutProcessor:558 - Timeout has occurred [obj=CancelableTask [id=4374d20a661-967c7da2-84ed-46d9-9ec1-fd64ab02e16a, endTime=1540285694437, period=3000, cancel=false, task=MetricsUpdater [prevGcTime=337, prevCpuTime=16515, super=org.apache.ignite.internal.managers.discovery.GridDiscoveryManager$MetricsUpdater@1fad637f]], process=true]
2018-10-23 09:08:15 DEBUG TcpCommunicationSpi:558 - Balancing data [min0=0, minIdx=0, max0=-1, maxIdx=-1]
2018-10-23 09:08:16 DEBUG GridTimeoutProcessor:558 - Timeout has occurred [obj=CancelableTask [id=1374d20a661-967c7da2-84ed-46d9-9ec1-fd64ab02e16a, endTime=1540285696182, period=10000, cancel=false, task=org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$12@1c86b2f2], process=true]
2018-10-23 09:08:16 DEBUG ClientListenerProcessor:558 - Balancing data [min0=0, minIdx=0, max0=-1, maxIdx=-1]
2018-10-23 09:08:16 DEBUG GridTimeoutProcessor:558 - Timeout has occurred [obj=CancelableTask [id=2374d20a661-967c7da2-84ed-46d9-9ec1-fd64ab02e16a, endTime=1540285696405, period=2000, cancel=false, task=org.apache.ignite.internal.processors.query.h2.IgniteH2Indexing$13@2e49ebc1], process=true]
2018-10-23 09:08:17 DEBUG GridCachePartitionExchangeManager:558 - Before waiting for exchange futures [futs[], worker=GridWorker [name=partition-exchanger, igniteInstanceName=null, finished=false, hashCode=215498915, interrupted=false, runner=exchange-worker-#35]]

以此类推。

有时还会打印:

2018-10-23 09:07:59 INFO  IgniteKernal:566 - 
Metrics for local node (to disable set 'metricsLogFrequency' to 0)
    ^-- Node [id=a7f30542, uptime=00:01:00.019]
    ^-- H/N/C [hosts=2, nodes=4, CPUs=4]
    ^-- CPU [cur=1.67%, avg=9.47%, GC=0%]
    ^-- PageMemory [pages=0]
    ^-- Heap [used=278MB, free=69.36%, comm=478MB]
    ^-- Non heap [used=129MB, free=-1%, comm=130MB]
    ^-- Outbound messages queue [size=0]
    ^-- Public thread pool [active=0, idle=0, qSize=0]
    ^-- System thread pool [active=0, idle=4, qSize=0]

我只是在Ignite上进行非常简单的读/写操作,并且在使用...配置读/写器时

.option(IgniteDataFrameSettings.OPTION_CONFIG_FILE, path)

path对应于以下配置文件:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
                       http://www.springframework.org/schema/beans/spring-beans.xsd">
                       <bean class="org.apache.ignite.configuration.IgniteConfiguration">
                         <!-- Enabling Apache Ignite native persistence. -->
                         <property name="dataStorageConfiguration">
                           <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
                             <property name="defaultDataRegionConfiguration">
                               <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                                 <property name="persistenceEnabled" value="true"/>
                               </bean>
                             </property>
                           </bean>
                         </property>
                       </bean>
</beans>

更新:

设置如下。我目前正在使用Vagrant + Ansible + VirtualBox来运行三台计算机。第一个运行Spark Master,其他运行Spark Worker。在所有机器上都配置了Ignite,但仅在工作服务器上使用ignite.sh脚本运行它。它配置为启用了持久性,因此也可以通过发出control.sh --activate来激活集群。

一切正常,我可以使用REST API对数据进行事件查询,唯一似乎不起作用的事情是使应用程序保持运行状态。

更新2:

@StephenDarlington的建议部分起作用。在应用程序末尾关闭Spark上下文,使执行程序完成任务。另一方面,从UI上我现在可以看到0个应用程序正在运行,但是驱动程序仍处于运行状态。

这是驱动程序的标准输出:

2018-10-26 11:05:37 DEBUG G:558 - Ignite instance stopped ok: null
2018-10-26 11:05:37 INFO  StandaloneSchedulerBackend:54 - Shutting down all executors
2018-10-26 11:05:37 INFO  CoarseGrainedSchedulerBackend$DriverEndpoint:54 - Asking each executor to shut down
2018-10-26 11:05:37 INFO  MapOutputTrackerMasterEndpoint:54 - MapOutputTrackerMasterEndpoint stopped!
2018-10-26 11:05:37 INFO  MemoryStore:54 - MemoryStore cleared
2018-10-26 11:05:37 INFO  BlockManager:54 - BlockManager stopped
2018-10-26 11:05:37 INFO  BlockManagerMaster:54 - BlockManagerMaster stopped
2018-10-26 11:05:37 INFO  OutputCommitCoordinator$OutputCommitCoordinatorEndpoint:54 - OutputCommitCoordinator stopped!
2018-10-26 11:05:37 INFO  SparkContext:54 - Successfully stopped SparkContext
2018-10-26 11:05:39 DEBUG PoolThreadCache:81 - Freed 25 thread-local buffer(s) from thread: shuffle-server-7-2
2018-10-26 11:05:39 DEBUG PoolThreadCache:81 - Freed 31 thread-local buffer(s) from thread: rpc-server-5-1
2018-10-26 11:05:39 DEBUG PoolThreadCache:81 - Freed 4 thread-local buffer(s) from thread: rpc-server-5-2

1 个答案:

答案 0 :(得分:0)

Spark如何(不是)管理Ignite服务器

因此,您正在Standalone mode中运行与Spark的Ignite集成。

在这种模式下,Ignite节点独立于Spark运行,Spark不会控制Ignite的生命周期。将其与任何其他数据库进行比较-应用程序不会自行启动和停止MySQL,MySQL会自行运行。

为便于说明,请将其与embedded mode请勿使用该模式,不建议使用,最终将其删除)。这样,Spark在每个工作线程中启动Ignite服务器本身,并在完成后停止它们。它在某种程度上(尽管不是完全)类似于使用SQLite运行的应用程序-没有SQLite服务器在该应用程序外部运行并单独管理。

如何手动关闭Ignite群集

如果要在使用Spark完成后杀死Ignite节点,则必须自己完成。有几种选择。

使用kill

是的,好,旧的kill <pid>。最好不要使用kill -9来让Ignite捕获信号并执行一些清理,尽管考虑到您的kill -9walMode或{{1 }}。

您可以通过某种方式在Spark应用程序关闭期间触发FSYNC

使用LOG_ONLYkill

有一个技巧可以用来通过Java代码杀死远程节点。

Ignition::stop方法停止本地Ignite节点。您可以通过IgniteCompute在每个节点上远程执行该操作。只需记住要从正在发送的任务中生成新线程-试图从任务本身中停止Ignite是一个坏主意。

代码大致如下所示(未经测试!):

Ignition::stop
相关问题