Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

获取不到serverPort属性 #6

Open
zhaoyiran925 opened this issue Sep 1, 2020 · 5 comments
Open

获取不到serverPort属性 #6

zhaoyiran925 opened this issue Sep 1, 2020 · 5 comments

Comments

@zhaoyiran925
Copy link

大佬你好。学习raft中,运行RaftNodeBootStrap时,System.getProperty("serverPort")报错,提示为空,获取不到该属性,这是在哪里设置这个属性的,请有空解答下,谢谢
2

@su-yh
Copy link

su-yh commented Jan 29, 2022

我也遇到这个问题,我是这样处理的。在idea 的应用配置(Edit Configurations...)里面的Program arguments输入框里面输入端口号。我这里没法截图上传

    public static void main(String[] args) throws Throwable {
        Integer port = Integer.valueOf(args[0]);
        System.setProperty("serverPort", port + "");
        main0();
    }

@JMILI
Copy link

JMILI commented Mar 5, 2022

节点启动类。这里启动多个结点。注意这里不用修改代码,作者已经写好了
image

配置启动类

image

新建

image

最后

image

最后,重复这个操作,分别配置5个启动类即可,

image

@Espresso-Kp
Copy link

您好,感谢分享解决办法!我在测试时按照你的方法配置了五个启动项,但是仍然不能成功选举出leader,因为ElectionTask RPC仍然会fail,我不太清楚这是哪里出现了问题,还望有空能指教一下

2023-01-26 19:29:06,878 Raft thread ERROR [cn.think.in.java.impl.DefaultNode:lambda$run$3:581] - ElectionTask RPC Fail , URL : localhost:8775
2023-01-26 19:29:06,879 Raft thread ERROR [cn.think.in.java.impl.DefaultNode:lambda$run$3:581] - ElectionTask RPC Fail , URL : localhost:8776
2023-01-26 19:29:08,915 Raft thread ERROR [cn.think.in.java.impl.DefaultNode:lambda$run$3:581] - ElectionTask RPC Fail , URL : localhost:8779
2023-01-26 19:29:08,916 Raft thread ERROR [cn.think.in.java.impl.DefaultNode:lambda$run$3:581] - ElectionTask RPC Fail , URL : localhost:8778

@kebukeYi
Copy link

image
我的没有更改什么代码,可以正常选出 Leader 哎

@JMILI
Copy link

JMILI commented Jun 27, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants