Browse Source

Merge branch 'master' of https://github.com/chrislusf/seaweedfs

pull/3171/head
chrislu 3 years ago
parent
commit
a74e926063
  1. 1
      docker/prometheus/prometheus.yml
  2. 3
      docker/seaweedfs-compose.yml
  3. 12
      weed/server/filer_ui/filer.html
  4. 6
      weed/server/volume_grpc_client_to_master.go
  5. 9
      weed/stats/metrics.go
  6. 9
      weed/topology/node.go

1
docker/prometheus/prometheus.yml

@ -8,6 +8,7 @@ scrape_configs:
static_configs: static_configs:
- targets: - targets:
- 'prometheus:9090' - 'prometheus:9090'
- 'master:9324'
- 'volume:9325' - 'volume:9325'
- 'filer:9326' - 'filer:9326'
- 's3:9327' - 's3:9327'

3
docker/seaweedfs-compose.yml

@ -6,7 +6,8 @@ services:
ports: ports:
- 9333:9333 - 9333:9333
- 19333:19333 - 19333:19333
command: "master -ip=master -ip.bind=0.0.0.0"
- 9324:9324
command: "master -ip=master -ip.bind=0.0.0.0 -metricsPort=9324"
volume: volume:
image: chrislusf/seaweedfs # use a remote image image: chrislusf/seaweedfs # use a remote image
ports: ports:

12
weed/server/filer_ui/filer.html

@ -225,6 +225,10 @@
handleFiles(files); handleFiles(files);
} }
function reloadPage() {
window.location.reload(true);
}
var uploadList = {}; var uploadList = {};
function handleFiles(files) { function handleFiles(files) {
@ -277,7 +281,7 @@
} }
if (allFinish) { if (allFinish) {
console.log('All Finish'); console.log('All Finish');
window.location.reload();
reloadPage();
} }
} }
@ -318,7 +322,7 @@
xhr.open('POST', url, false); xhr.open('POST', url, false);
xhr.setRequestHeader('Content-Type', ''); xhr.setRequestHeader('Content-Type', '');
xhr.send(); xhr.send();
window.location.reload();
reloadPage();
} }
function handleRename(originName, basePath) { function handleRename(originName, basePath) {
@ -333,7 +337,7 @@
xhr.open('POST', url, false); xhr.open('POST', url, false);
xhr.setRequestHeader('Content-Type', ''); xhr.setRequestHeader('Content-Type', '');
xhr.send(); xhr.send();
window.location.reload();
reloadPage();
} }
function handleDelete(path) { function handleDelete(path) {
@ -348,7 +352,7 @@
var xhr = new XMLHttpRequest(); var xhr = new XMLHttpRequest();
xhr.open('DELETE', url, false); xhr.open('DELETE', url, false);
xhr.send(); xhr.send();
window.location.reload();
reloadPage();
} }
</script> </script>
</html> </html>

6
weed/server/volume_grpc_client_to_master.go

@ -119,15 +119,15 @@ func (vs *VolumeServer) doHeartbeat(masterAddress pb.ServerAddress, grpcDialOpti
return return
} }
if len(in.DuplicatedUuids) > 0 { if len(in.DuplicatedUuids) > 0 {
var duplictedDir []string
var duplicateDir []string
for _, loc := range vs.store.Locations { for _, loc := range vs.store.Locations {
for _, uuid := range in.DuplicatedUuids { for _, uuid := range in.DuplicatedUuids {
if uuid == loc.DirectoryUuid { if uuid == loc.DirectoryUuid {
duplictedDir = append(duplictedDir, loc.Directory)
duplicateDir = append(duplicateDir, loc.Directory)
} }
} }
} }
glog.Errorf("Shut down Volume Server due to duplicated volume directories: %v", duplictedDir)
glog.Errorf("Shut down Volume Server due to duplicate volume directories: %v", duplicateDir)
os.Exit(1) os.Exit(1)
} }
if in.GetVolumeSizeLimit() != 0 && vs.store.GetVolumeSizeLimit() != in.GetVolumeSizeLimit() { if in.GetVolumeSizeLimit() != 0 && vs.store.GetVolumeSizeLimit() != in.GetVolumeSizeLimit() {

9
weed/stats/metrics.go

@ -44,6 +44,14 @@ var (
Help: "Counter of master received heartbeat.", Help: "Counter of master received heartbeat.",
}, []string{"type"}) }, []string{"type"})
MasterReplicaPlacementMismatch = prometheus.NewGaugeVec(
prometheus.GaugeOpts{
Namespace: "SeaweedFS",
Subsystem: "master",
Name: "replica_placement_mismatch",
Help: "replica placement mismatch",
}, []string{"collection", "id"})
MasterLeaderChangeCounter = prometheus.NewCounterVec( MasterLeaderChangeCounter = prometheus.NewCounterVec(
prometheus.CounterOpts{ prometheus.CounterOpts{
Namespace: "SeaweedFS", Namespace: "SeaweedFS",
@ -165,6 +173,7 @@ func init() {
Gather.MustRegister(MasterRaftIsleader) Gather.MustRegister(MasterRaftIsleader)
Gather.MustRegister(MasterReceivedHeartbeatCounter) Gather.MustRegister(MasterReceivedHeartbeatCounter)
Gather.MustRegister(MasterLeaderChangeCounter) Gather.MustRegister(MasterLeaderChangeCounter)
Gather.MustRegister(MasterReplicaPlacementMismatch)
Gather.MustRegister(FilerRequestCounter) Gather.MustRegister(FilerRequestCounter)
Gather.MustRegister(FilerRequestHistogram) Gather.MustRegister(FilerRequestHistogram)

9
weed/topology/node.go

@ -3,6 +3,7 @@ package topology
import ( import (
"errors" "errors"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/stats"
"github.com/chrislusf/seaweedfs/weed/storage/erasure_coding" "github.com/chrislusf/seaweedfs/weed/storage/erasure_coding"
"github.com/chrislusf/seaweedfs/weed/storage/needle" "github.com/chrislusf/seaweedfs/weed/storage/needle"
"github.com/chrislusf/seaweedfs/weed/storage/types" "github.com/chrislusf/seaweedfs/weed/storage/types"
@ -246,6 +247,14 @@ func (n *NodeImpl) CollectDeadNodeAndFullVolumes(freshThreshHold int64, volumeSi
} else if float64(v.Size) > float64(volumeSizeLimit)*growThreshold { } else if float64(v.Size) > float64(volumeSizeLimit)*growThreshold {
n.GetTopology().chanCrowdedVolumes <- v n.GetTopology().chanCrowdedVolumes <- v
} }
copyCount := v.ReplicaPlacement.GetCopyCount()
if copyCount > 1 {
if copyCount > len(n.GetTopology().Lookup(v.Collection, v.Id)) {
stats.MasterReplicaPlacementMismatch.WithLabelValues(v.Collection, v.Id.String()).Set(1)
} else {
stats.MasterReplicaPlacementMismatch.WithLabelValues(v.Collection, v.Id.String()).Set(0)
}
}
} }
} }
} else { } else {

Loading…
Cancel
Save