【问题标题】:How do I cleanly shutdown a distributed ActivePivot setup?如何彻底关闭分布式 ActivePivot 设置?
【发布时间】:2015-02-12 23:20:47
【问题描述】:

我们有一个 ActivePivot 立方体,它是一个多态立方体(2 个节点),其中 1 个节点本身就是一个水平分布的立方体(8 个节点)。在 Tomcat 中运行,使用 JGroup TCP 进行分发。每天重启一次,但每次关闭(节点服务依次停止),日志中都会出现各种错误。这是无害的,但从监控的角度来看是令人讨厌的。

一天的例子(所有相同的节点):

19:04:43.100 ERROR [Pool-LongPollin][streaming] A listener dropped (5f587379-ac67-4645-8554-2e02ed739924). The number of listeners is now 1
19:04:45.767 ERROR [Pool-LongPollin][streaming] Publishing global failure
19:05:16.313 ERROR [localhost-start][core] Failed to stop feed type MDXFEED with id A1C1D8D92CF7D867F09DCB7E65077B18.0.PT0

另一天的示例(来自多个不同节点的相同错误):

19:00:17.353 ERROR [pivot-remote-0-][distribution] A safe broadcasting task could not be performed
com.quartetfs.fwk.QuartetRuntimeException: [<node name>] Cannot run a broadcasting task with a STOPPED messenger

有没有人知道关闭这种设置的干净方法?

【问题讨论】:

    标签: activepivot


    【解决方案1】:

    出现这些错误是因为在应用程序关闭时 ActivePivotManager 正在积极停止分发,而不是等待每个分发的 ActivePivot 被通知其他多维数据集已停止。

    要顺利停止分发,您可以使用 DistributionUtil 类中的方法。例如:

    public class DistributionStopper {
    
    protected final IActivePivotManager manager;
    
    public DistributionStopper (IActivePivotManager manager){
        this.manager = manager;
    }
    
    public void stop(){
        // Get all the schemas from the manager
        final Collection<IActivePivotSchema> schemas = manager.getSchemas().values();
    
        // To store all the available messengers
        final List<IDistributedMessenger<?>> availableMessengers = new LinkedList<>();
    
        // Find all the messengers
        for(IActivePivotSchema schema : schemas){
            for(String pivotId : schema.getPivotIds()){
                // Retrieve the activePivot matching this id
                final IMultiVersionActivePivot pivot = schema.retrieveActivePivot(pivotId);
    
                if(pivot instanceof IMultiVersionDistributedActivePivot){
                    IDistributedMessenger<IActivePivotSession> messenger = ((IMultiVersionDistributedActivePivot) pivot).getMessenger();
                    if(messenger != null){
                        availableMessengers.add(messenger);
                    }
                }
            }
        }
    
        // Smoothly stop the messengers
        DistributionUtil.stopMessengers(availableMessengers);
    }
    
    }
    

    然后根据 activePivotManager 单例 bean 将此自定义类注册为 Spring bean,以便在管理器之一之前调用其 destroyMethod。

    @Bean(destroyMethod="stop")
    @DependsOn("activePivotManager")
    public DistributionStopper distributionStopper(IActivePivotManager manager){
        return new DistributionStopper(manager);
    }
    

    【讨论】:

    • 它似乎完成了这项工作,谢谢。我还有另一个关机错误:无法访问 [localhost:8080/remoting/LongPollingService]; 处的 HTTP 调用程序远程服务;嵌套异常是 java.net.SocketException: Connection reset,但我想这一定是关于多维数据集和实时服务器关闭顺序的另一个问题。
    • 更正:建议的解决方案是一种改进,但我仍然看到问题:19:00:50.403 INFO [localhost-start][DistributionStopper] 分布式信使停止,19:00:50.403 INFO [pivot- remote-0-][distribution] 在广播任务期间遇到异常。重试...(...引起...信使未连接),19:00:50.403错误[pivot-remote-0-] [分发]无法执行安全广播任务:无法运行广播使用 STOPPED 信使的任务。
    猜你喜欢
    • 2018-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-07-05
    • 1970-01-01
    • 1970-01-01
    • 2010-09-26
    • 2010-10-03
    相关资源
    最近更新 更多