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

2.13: With the same start parameters, the Linux version can start normally, but the Windows version cannot #1671

Closed
GarinQian opened this issue Dec 11, 2020 · 9 comments

Comments

@GarinQian
Copy link

Describe the bug
With the same start parameters, the Linux version can start normally, but the Windows version cannot.

System Setup
on windows:
.\weed.exe server --master.port=9333 --volume.port=9222 --volume.max=200 --filer --filer.port=9111 --dir="D:\weed\seaweedfs"
on CentOS7.4:
./weed server -master.port=9333 -volume.port=9222 -volume.max=200 -filer -filer.port=9111 -dir="./data"

  • OS version
    version 30GB 2.13 0e99531 windows amd64
    version 30GB 2.13 0e99531 linux amd64

  • if using filer, show the content of filer.toml
    [mysql] # or tidb
    enabled = true
    hostname = "localhost"
    port = 3306
    username = "user1"
    password = "password1"
    database = "database1" # create or use an existing database
    connection_max_idle = 2
    connection_max_open = 100
    Expected behavior
    successfully visit http://127.0.0.1:9111

Screenshots
on win10:
image
image

on centos7.4:
image
image

@chrislusf
Copy link
Collaborator

on windows:
.\weed.exe server --master.port=9333 --volume.port=9222 --volume.max=200 --filer --filer.port=9111 --dir="D:\weed\seaweedfs"

can you use single dash instead of double dash?

@GarinQian
Copy link
Author

不好意思之前表述的不太清楚,问题不是一个-和两个--,问题是windows启动的时候没指定ip和ip.bind,出现了如上面第一个截图中的获取到本地IP(10.122.0.154:9333)作为master,但是当时ipconfig出来并没有这个ip。今天又试了一下同样的步骤又没有复现了。

@chrislusf
Copy link
Collaborator

Thanks for the update!

@GarinQian
Copy link
Author

GarinQian commented Dec 14, 2020

昨天在家里没有复现,今天来公司办公室测试了一下,遇到了同样的问题。应该是跟公司的网络环境有关,我重新表述一下问题:

版本:version 30GB 2.13 0e99531 windows amd64

启动方式(并不是-和--的问题,windows上参数必须是--才能识别):
方式一:.\weed.exe server --master.port=9333 --volume.port=9222 --volume.max=200 --filer --filer.port=9111 --dir="D:\weed\seaweedfs"
方式二:.\weed.exe server --ip=localhost --ip.bind=localhost --master.port=9333 --volume.port=9222 --volume.max=200 --filer --filer.port=9111 --dir="D:\weed\seaweedfs"

现象:方式二正常启动;方式一启动失败。
方式一失败原因:获取到本地IP(10.122.0.154:9333)作为master,但是10.122.0.154并不在本地网卡的IP列表里,也不在路由表的IP列表中。

测试:尝试把/weed/util/network/DetectedHostAddress修改为如下,则可以正常获取到本地IP:
`func DetectedHostAddress() string {
netInterfaces, err := net.Interfaces()
if err != nil {
glog.V(0).Infof("failed to detect ip address: %v", err)
return ""
}

for i := 0; i < len(netInterfaces); i++ {
	if (netInterfaces[i].Flags & net.FlagUp) != 0 {
		addrs, _ := netInterfaces[i].Addrs()

		for _, address := range addrs {
			if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
				if ipnet.IP.To4() != nil {
					return ipnet.IP.String()
				}
			}
		}
	}
}

return "localhost"

}`

@chrislusf
Copy link
Collaborator

chrislusf commented Dec 14, 2020

set -ip

the ip info is to identify the server itself.

@GarinQian
Copy link
Author

嗯我现在加了-ip。我之前看你这边提供了默认获取本机地址,就没有设置-ip。可以考虑完善一下DetectedHostAddress,正确获取本地的可用IP。

chrislusf added a commit that referenced this issue Dec 14, 2020
following advice from #1671
@chrislusf
Copy link
Collaborator

Thanks for the suggestion! Added 0213587

You are welcome to make a PR later!

@GarinQian
Copy link
Author

Thanks for the quick response. I will try it later. By the way, do you have any discussion groups? Sometimes, as users, we can find someone to discuss and exchange experience when we encounter problems.

@chrislusf
Copy link
Collaborator

chrislusf commented Dec 14, 2020

you can use slack.

there are also two wechat groups. My wechat account is chrislusf

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

2 participants