[Ubuntu VM持久存在时,点燃异常:打开的文件太多

问题描述 投票:0回答:1

我在Java代码包xxx.jar中运行服务器节点,但发生了如下异常:

Caused by: java.nio.file.FileSystemException: /home/ranger/EIIP/tools/work/db/ServerNode/cache-TOFTableCache/part-942.bin: Too many open files
at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
at sun.nio.fs.UnixFileSystemProvider.newAsynchronousFileChannel(UnixFileSystemProvider.java:196)
at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:248)
at java.nio.channels.AsynchronousFileChannel.open(AsynchronousFileChannel.java:301)
at org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIO.<init>(AsyncFileIO.java:66)
at org.apache.ignite.internal.processors.cache.persistence.file.AsyncFileIOFactory.create(AsyncFileIOFactory.java:44)
at org.apache.ignite.internal.processors.cache.persistence.file.FilePageStore.init(FilePageStore.java:523)
... 31 more

但仅在Windows的ubuntu VM中发生,并且在纯ubuntu系统上运行时没有此异常,我尝试了以下方法,但仍然是相同的问题:

vim /etc/security/limits.conf
root soft nofile 10240
root hard nofile 20480

vim /etc/sysctl.conf
fs.inotify.max_user_watches=524288
ulimit -n 4096

这是我的代码:

        IgniteConfiguration igniteCfg = new IgniteConfiguration();
        igniteCfg.setConsistentId("ServerNode"); //Set Consistent ID

        // Ignite Persistence
        DataStorageConfiguration storageCfg = new DataStorageConfiguration();
        DataRegionConfiguration regionCfg = new DataRegionConfiguration();
        regionCfg.setName("TableCache_Region");
        regionCfg.setInitialSize(100L * 1024 * 1024);
        regionCfg.setMaxSize(8L * 1024 * 1024 * 1024);
        regionCfg.setPersistenceEnabled(true);

        storageCfg.setDataRegionConfigurations(regionCfg);
        storageCfg.setPageSize(4096); // Changing the page size to 4 KB.
        storageCfg.setWriteThrottlingEnabled(true); // Enabling the writes throttling.

        igniteCfg.setDataStorageConfiguration(storageCfg);
        igniteCfg.setWorkDirectory(System.getProperty("user.dir") + "/work"); // System.getProperty("java.class.path")

        Ignite ignite = Ignition.start(igniteCfg);
        ignite.cluster().baselineAutoAdjustEnabled(false);

        // Activate a cluster automatically once all the nodes of the baseline topology have joined after a cluster restart.
        ignite.cluster().active(true);

        // Manually setting Baseline Topology
        Collection<ClusterNode> nodes = ignite.cluster().forServers().nodes();
        // Set all server nodes to baseline topology
        ignite.cluster().setBaselineTopology(nodes);

任何想法如何解决此问题?谢谢。enter image description here

ignite
1个回答
0
投票

据我所知,重新启动后会持续保留ulimits值,您应该在配置文件中设置它:

/ etc / security / limits.conf

它包含“ soft”“ hard”选项。 root的硬选项,其他人的软选项。

使用ulimit命令,您可以覆盖当前用户和会话的“ soft”值。可能没有存储您的限制,或者您设置了“ soft”选项,但是使用sudo命令启动了GridGain,并且您的“ hard”选项不正确。

请您仔细检查并提供以下信息:

1)您使用什么操作系统?

2)您的环境中是否有/etc/security/limits.conf文件?

3)您是否有将启动Ignite的用户正确的值。如果您是在根目录下启动的,请检查“硬”选项

但是,我建议在此处设置以下选项:

ignite soft nofile 65536
ignite hard nofile 65536
ignite soft nproc 65536
ignite hard nproc 65536

其中ignite是用于Ignite启动的用户名。

© www.soinside.com 2019 - 2024. All rights reserved.