mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
add -reverseProxyServer="volume.xxx.com" to volume server try to fix #9
This commit is contained in:
parent
a2b1afce78
commit
3beb80c907
|
@ -49,6 +49,7 @@ var cmdServer = &Command{
|
||||||
var (
|
var (
|
||||||
serverIp = cmdServer.Flag.String("ip", "", "ip or server name")
|
serverIp = cmdServer.Flag.String("ip", "", "ip or server name")
|
||||||
serverPublicIp = cmdServer.Flag.String("publicIp", "", "ip or server name")
|
serverPublicIp = cmdServer.Flag.String("publicIp", "", "ip or server name")
|
||||||
|
reverseProxyServer = cmdServer.Flag.String("reverseProxyServer", "", "front-end reverse proxy server url <ip:port|domain_name>, for replication > 000")
|
||||||
serverBindIp = cmdServer.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to")
|
serverBindIp = cmdServer.Flag.String("ip.bind", "0.0.0.0", "ip address to bind to")
|
||||||
serverMaxCpu = cmdServer.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs")
|
serverMaxCpu = cmdServer.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs")
|
||||||
serverTimeout = cmdServer.Flag.Int("idleTimeout", 10, "connection idle seconds")
|
serverTimeout = cmdServer.Flag.Int("idleTimeout", 10, "connection idle seconds")
|
||||||
|
@ -230,10 +231,13 @@ func runServer(cmd *Command, args []string) bool {
|
||||||
*serverIp, *volumePort, *volumeAdminPort, *serverPublicIp,
|
*serverIp, *volumePort, *volumeAdminPort, *serverPublicIp,
|
||||||
folders, maxCounts,
|
folders, maxCounts,
|
||||||
*serverIp+":"+strconv.Itoa(*masterPort), *volumePulse, *serverDataCenter, *serverRack,
|
*serverIp+":"+strconv.Itoa(*masterPort), *volumePulse, *serverDataCenter, *serverRack,
|
||||||
serverWhiteList, *volumeFixJpgOrientation,
|
serverWhiteList, *volumeFixJpgOrientation, *reverseProxyServer,
|
||||||
)
|
)
|
||||||
|
|
||||||
glog.V(0).Infoln("Start Seaweed volume server", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*volumePort))
|
glog.V(0).Infoln("Start Seaweed volume server", util.VERSION, "at", *serverIp+":"+strconv.Itoa(*volumePort))
|
||||||
|
if *reverseProxyServer != "" {
|
||||||
|
glog.V(0).Infoln("The Seaweed volume server", util.VERSION, " is running behind the reverse proxy server", *reverseProxyServer)
|
||||||
|
}
|
||||||
volumeListener, e := util.NewListener(
|
volumeListener, e := util.NewListener(
|
||||||
*serverBindIp+":"+strconv.Itoa(*volumePort),
|
*serverBindIp+":"+strconv.Itoa(*volumePort),
|
||||||
time.Duration(*serverTimeout)*time.Second,
|
time.Duration(*serverTimeout)*time.Second,
|
||||||
|
|
|
@ -33,6 +33,7 @@ type VolumeServerOptions struct {
|
||||||
rack *string
|
rack *string
|
||||||
whiteList []string
|
whiteList []string
|
||||||
fixJpgOrientation *bool
|
fixJpgOrientation *bool
|
||||||
|
reverseProxyServer *string
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -49,6 +50,7 @@ func init() {
|
||||||
v.dataCenter = cmdVolume.Flag.String("dataCenter", "", "current volume server's data center name")
|
v.dataCenter = cmdVolume.Flag.String("dataCenter", "", "current volume server's data center name")
|
||||||
v.rack = cmdVolume.Flag.String("rack", "", "current volume server's rack name")
|
v.rack = cmdVolume.Flag.String("rack", "", "current volume server's rack name")
|
||||||
v.fixJpgOrientation = cmdVolume.Flag.Bool("images.fix.orientation", true, "Adjust jpg orientation when uploading.")
|
v.fixJpgOrientation = cmdVolume.Flag.Bool("images.fix.orientation", true, "Adjust jpg orientation when uploading.")
|
||||||
|
v.reverseProxyServer = cmdVolume.Flag.String("reverseProxyServer", "", "front-end reverse proxy server url <ip:port|domain_name>, for replication > 000")
|
||||||
}
|
}
|
||||||
|
|
||||||
var cmdVolume = &Command{
|
var cmdVolume = &Command{
|
||||||
|
@ -122,6 +124,7 @@ func runVolume(cmd *Command, args []string) bool {
|
||||||
*v.master, *v.pulseSeconds, *v.dataCenter, *v.rack,
|
*v.master, *v.pulseSeconds, *v.dataCenter, *v.rack,
|
||||||
v.whiteList,
|
v.whiteList,
|
||||||
*v.fixJpgOrientation,
|
*v.fixJpgOrientation,
|
||||||
|
*v.reverseProxyServer,
|
||||||
)
|
)
|
||||||
|
|
||||||
listeningAddress := *v.bindIp + ":" + strconv.Itoa(*v.port)
|
listeningAddress := *v.bindIp + ":" + strconv.Itoa(*v.port)
|
||||||
|
@ -151,5 +154,9 @@ func runVolume(cmd *Command, args []string) bool {
|
||||||
if e := http.Serve(listener, publicMux); e != nil {
|
if e := http.Serve(listener, publicMux); e != nil {
|
||||||
glog.Fatalf("Volume server fail to serve: %v", e)
|
glog.Fatalf("Volume server fail to serve: %v", e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if *v.reverseProxyServer != "" {
|
||||||
|
glog.V(0).Infoln("The Seaweed volume server", util.VERSION, "is running behind the reverse proxy server", *v.reverseProxyServer)
|
||||||
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,13 @@ func NewVolumeServer(publicMux, adminMux *http.ServeMux, ip string,
|
||||||
masterNode string, pulseSeconds int,
|
masterNode string, pulseSeconds int,
|
||||||
dataCenter string, rack string,
|
dataCenter string, rack string,
|
||||||
whiteList []string,
|
whiteList []string,
|
||||||
fixJpgOrientation bool) *VolumeServer {
|
fixJpgOrientation bool,
|
||||||
|
reverseProxyServer string) *VolumeServer {
|
||||||
|
|
||||||
publicUrl := publicIp + ":" + strconv.Itoa(port)
|
publicUrl := publicIp + ":" + strconv.Itoa(port)
|
||||||
|
if reverseProxyServer != "" {
|
||||||
|
publicUrl = reverseProxyServer
|
||||||
|
}
|
||||||
vs := &VolumeServer{
|
vs := &VolumeServer{
|
||||||
masterNode: masterNode,
|
masterNode: masterNode,
|
||||||
pulseSeconds: pulseSeconds,
|
pulseSeconds: pulseSeconds,
|
||||||
|
|
Loading…
Reference in a new issue