Browse Source

add -reverseProxyServer="volume.xxx.com" to volume server try to fix #9

pull/76/head
yourchanges 10 years ago
parent
commit
3beb80c907
  1. 6
      go/weed/server.go
  2. 7
      go/weed/volume.go
  3. 7
      go/weed/weed_server/volume_server.go

6
go/weed/server.go

@ -49,6 +49,7 @@ var cmdServer = &Command{
var (
serverIp = cmdServer.Flag.String("ip", "", "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")
serverMaxCpu = cmdServer.Flag.Int("maxCpu", 0, "maximum number of CPUs. 0 means all available CPUs")
serverTimeout = cmdServer.Flag.Int("idleTimeout", 10, "connection idle seconds")
@ -230,10 +231,13 @@ func runServer(cmd *Command, args []string) bool {
*serverIp, *volumePort, *volumeAdminPort, *serverPublicIp,
folders, maxCounts,
*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))
if *reverseProxyServer != "" {
glog.V(0).Infoln("The Seaweed volume server", util.VERSION, " is running behind the reverse proxy server", *reverseProxyServer)
}
volumeListener, e := util.NewListener(
*serverBindIp+":"+strconv.Itoa(*volumePort),
time.Duration(*serverTimeout)*time.Second,

7
go/weed/volume.go

@ -33,6 +33,7 @@ type VolumeServerOptions struct {
rack *string
whiteList []string
fixJpgOrientation *bool
reverseProxyServer *string
}
func init() {
@ -49,6 +50,7 @@ func init() {
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.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{
@ -122,6 +124,7 @@ func runVolume(cmd *Command, args []string) bool {
*v.master, *v.pulseSeconds, *v.dataCenter, *v.rack,
v.whiteList,
*v.fixJpgOrientation,
*v.reverseProxyServer,
)
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 {
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
}

7
go/weed/weed_server/volume_server.go

@ -28,8 +28,13 @@ func NewVolumeServer(publicMux, adminMux *http.ServeMux, ip string,
masterNode string, pulseSeconds int,
dataCenter string, rack string,
whiteList []string,
fixJpgOrientation bool) *VolumeServer {
fixJpgOrientation bool,
reverseProxyServer string) *VolumeServer {
publicUrl := publicIp + ":" + strconv.Itoa(port)
if reverseProxyServer != "" {
publicUrl = reverseProxyServer
}
vs := &VolumeServer{
masterNode: masterNode,
pulseSeconds: pulseSeconds,

Loading…
Cancel
Save