Skip to content

Commit

Permalink
Synchronous changes from the master branch
Browse files Browse the repository at this point in the history
Signed-off-by: Mofei Zhang <[email protected]>
  • Loading branch information
mervinkid committed Feb 4, 2020
2 parents 0009306 + 4c72064 commit 60f16ed
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 44 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
## Release v1.5.1 - 2020/01/19

### Enhancement
* support building docker image that contains both cfs-server and cfs-client. https://github.com/chubaofs/chubaofs/commit/8f41e5fbe8c26a057f0ba042d06716ac0da4b0b9

### Bug fix
* only one replica of meta partition can be taken offline at the same time. https://github.com/chubaofs/chubaofs/commit/3450baeebc3a2d914d668765cc051bd4972bc7e2
* check if server port is open before raft leader change. https://github.com/chubaofs/chubaofs/commit/42d2dedb952592bc739ab1a0bfa3c99a4972ff94
* solved several issue in signature algorithm version 2. https://github.com/chubaofs/chubaofs/commit/7bfca0937d86e20d368f19b1e258700e479a1559
* solved the issue related to copying files across folder through object storage interface. https://github.com/chubaofs/chubaofs/commit/0a102eb8c8afc0f26d7cff4c98435c1881cd2747

### Refactoring
* update dashboard configuration of grafana. https://github.com/chubaofs/chubaofs/commit/790d4b850feb8b7ebb2067afd3408663a9acb2b0
* unified the configuration of master address and listening port in documentation. https://github.com/chubaofs/chubaofs/commit/5fc59115d46dda21804935494623cbe2318456c6

### Document
* added benchmark data and guidelines for deploying ChubaoFS cluster with Helm in README file. https://github.com/chubaofs/chubaofs/commit/6c334e5b61423558b90685c72b5ce42147146749

## Release v1.5.0 - 2020/01/08

### Feature
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,5 @@ For more information, please refer to https://dl.acm.org/citation.cfm?doid=32998
## Community
- Twitter: [@ChubaoFS](https://twitter.com/ChubaoFS)
- Mailing list: should use [email protected]
- Mailing list: [email protected]
- Slack: [chubaofs.slack.com](https://chubaofs.slack.com/)
21 changes: 10 additions & 11 deletions datanode/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ var (
ErrNoSpaceToCreatePartition = errors.New("No disk space to create a data partition")
ErrNewSpaceManagerFailed = errors.New("Creater new space manager failed")

LocalIP ,serverPort string
gConnPool = util.NewConnectPool()
MasterClient = masterSDK.NewMasterClient(nil, false)
LocalIP, serverPort string
gConnPool = util.NewConnectPool()
MasterClient = masterSDK.NewMasterClient(nil, false)
)

const (
Expand Down Expand Up @@ -183,21 +183,20 @@ func (s *DataNode) parseConfig(cfg *config.Config) (err error) {
regexpPort *regexp.Regexp
)
LocalIP = cfg.GetString(ConfigKeyLocalIP)
port = cfg.GetString(ConfigKeyPort)
serverPort=port
port = cfg.GetString(proto.ListenPort)
serverPort = port
if regexpPort, err = regexp.Compile("^(\\d)+$"); err != nil {
return fmt.Errorf("Err:no port")
}
if !regexpPort.MatchString(port) {
return fmt.Errorf("Err:port must string")
}
s.port = port
masters := cfg.GetStringSlice(ConfigKeyMasterAddr)
if len(masters) == 0 {
return fmt.Errorf("invliad config %s", ConfigKeyMasterAddr)
if len(cfg.GetSlice(proto.MasterAddr)) == 0 {
return fmt.Errorf("Err:masterAddr unavalid")
}
for _, master := range masters {
MasterClient.AddNode(master)
for _, ip := range cfg.GetSlice(proto.MasterAddr) {
MasterClient.AddNode(ip.(string))
}
s.cellName = cfg.GetString(ConfigKeyCell)
if s.cellName == "" {
Expand All @@ -211,7 +210,7 @@ func (s *DataNode) parseConfig(cfg *config.Config) (err error) {

func (s *DataNode) startSpaceManager(cfg *config.Config) (err error) {
s.space = NewSpaceManager(s.cellName)
if err != nil || len(strings.TrimSpace(s.port)) == 0 {
if len(strings.TrimSpace(s.port)) == 0 {
err = ErrNewSpaceManagerFailed
return
}
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/datanode.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"role": "datanode",
"port": "17310",
"listen": "17310",
"prof": "17320",
"raftHeartbeat": "17330",
"raftReplica": "17340",
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/master1.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "1",
"role": "master",
"ip": "192.168.0.11",
"port": "17010",
"listen": "17010",
"prof": "17020",
"peers": "1:192.168.0.11:17010,2:192.168.0.12:17010,3:192.168.0.13:17010",
"retainLogs": "2",
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/master2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "2",
"role": "master",
"ip": "192.168.0.12",
"port": "17010",
"listen": "17010",
"prof": "17020",
"peers": "1:192.168.0.11:17010,2:192.168.0.12:17010,3:192.168.0.13:17010",
"retainLogs": "2",
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/master3.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"id": "3",
"role": "master",
"ip": "192.168.0.13",
"port": "17010",
"listen": "17010",
"prof": "17020",
"peers": "1:192.168.0.11:17010,2:192.168.0.12:17010,3:192.168.0.13:17010",
"retainLogs": "2",
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/metanode.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"totalMem":"536870912",
"metadataDir": "/cfs/data/meta",
"raftDir": "/cfs/data/raft",
"masterAddrs": [
"masterAddr": [
"192.168.0.11:17010",
"192.168.0.12:17010",
"192.168.0.13:17010"
Expand Down
2 changes: 1 addition & 1 deletion docker/conf/objectnode.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"logDir": "/cfs/log/",
"logLevel": "debug",
"listen": ":80",
"masters": [
"masterAddr": [
"192.168.0.11:17010",
"192.168.0.12:17010",
"192.168.0.13:17010"
Expand Down
6 changes: 3 additions & 3 deletions docs/source/quick-start-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Sample *master.json* is shown as follows,
{
"role": "master",
"ip": "192.168.31.173",
"port": "80",
"listen": "80",
"prof":"10088",
"id":"1",
"peers": "1:192.168.31.173:80,2:192.168.31.141:80,3:192.168.30.200:80",
Expand Down Expand Up @@ -127,7 +127,7 @@ Start Datanode
{
"role": "datanode",
"port": "6000",
"listen": "6000",
"prof": "6001",
"logDir": "/export/Logs/datanode",
"raftDir": "/export/Data/datanode/raft",
Expand Down Expand Up @@ -166,7 +166,7 @@ Sample *objectnode.json is* shown as follows,
"object.cfs.local"
],
"listen": 80,
"masters": [
"masterAddr": [
"master1.cfs.local:80",
"master2.cfs.local:80",
"master3.cfs.local:80"
Expand Down
4 changes: 2 additions & 2 deletions docs/source/user-guide/datanode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Configurations
:header: "Key", "Type", "Description", "Mandatory"

"role", "string", "Role of process and must be set to *datanode*", "Yes"
"port", "string", "Port of TCP network to be listen", "Yes"
"listen", "string", "Port of TCP network to be listen", "Yes"
"localIP", "string", "IP of network to be choose", "No,If not specified, the ip address used to communicate with the master is used."
"prof", "string", "Port of HTTP based prof and api service", "Yes"
"logDir", "string", "Path for log file storage", "Yes"
Expand All @@ -40,7 +40,7 @@ Configurations
{
"role": "datanode",
"port": "6000",
"listen": "6000",
"prof": "6001",
"localIP":"192.168.31.174",
"logDir": "/export/Logs/datanode",
Expand Down
4 changes: 2 additions & 2 deletions docs/source/user-guide/master.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ChubaoFS use **JSON** as configuration file format.

"role", "string", "Role of process and must be set to master", "Yes"
"ip", "string", "host ip", "Yes"
"port", "string", "Http port which api service listen on", "Yes"
"listen", "string", "Http port which api service listen on", "Yes"
"prof", "string", "golang pprof port", "Yes"
"id", "string", "identy different master node", "Yes"
"peers", "string", "the member information of raft group", "Yes"
Expand All @@ -47,7 +47,7 @@ ChubaoFS use **JSON** as configuration file format.
"role": "master",
"id":"1",
"ip": "192.168.31.173",
"port": "80",
"listen": "80",
"prof":"10088",
"peers": "1:192.168.31.173:80,2:192.168.31.141:80,3:192.168.30.200:80",
"retainLogs":"20000",
Expand Down
4 changes: 2 additions & 2 deletions docs/source/user-guide/objectnode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Object Node using `JSON` format configuration file.
"logLevel", "string", "
| Level operation for logging.
| Default: ``error``", "No"
"masters", "string slice", "
"masterAddr", "string slice", "
| Format: ``HOST:PORT``.
| HOST: Hostname, domain or IP address of master (resource manager).
| PORT: port number which listened by this master", "Yes"
Expand All @@ -57,7 +57,7 @@ Object Node using `JSON` format configuration file.
],
"logDir": "/opt/cfs/objectnode/logs",
"logLevel": "debug",
"masters": [
"masterAddr": [
"172.20.240.95:7002",
"172.20.240.94:7002",
"172.20.240.67:7002"
Expand Down
2 changes: 1 addition & 1 deletion master/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ func (m *Server) Sync() {
func (m *Server) checkConfig(cfg *config.Config) (err error) {
m.clusterName = cfg.GetString(ClusterName)
m.ip = cfg.GetString(IP)
m.port = cfg.GetString(Port)
m.port = cfg.GetString(proto.ListenPort)
m.walDir = cfg.GetString(WalDir)
m.storeDir = cfg.GetString(StoreDir)
peerAddrs := cfg.GetString(cfgPeers)
Expand Down
16 changes: 7 additions & 9 deletions metanode/metanode.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
clusterInfo *proto.ClusterInfo
masterClient *masterSDK.MasterClient
configTotalMem uint64
serverPort string
serverPort string
)

// The MetaNode manages the dentry and inode information of the meta partitions on a meta node.
Expand Down Expand Up @@ -173,8 +173,8 @@ func (m *MetaNode) parseConfig(cfg *config.Config) (err error) {
return
}
m.localAddr = cfg.GetString(cfgLocalIP)
m.listen = cfg.GetString(cfgListen)
serverPort=m.listen
m.listen = cfg.GetString(proto.ListenPort)
serverPort = m.listen
m.metadataDir = cfg.GetString(cfgMetadataDir)
m.raftDir = cfg.GetString(cfgRaftDir)
m.raftHeartbeatPort = cfg.GetString(cfgRaftHeartbeatPort)
Expand Down Expand Up @@ -213,12 +213,10 @@ func (m *MetaNode) parseConfig(cfg *config.Config) (err error) {
log.LogInfof("[parseConfig] load raftHeartbeatPort[%v].", m.raftHeartbeatPort)
log.LogInfof("[parseConfig] load raftReplicatePort[%v].", m.raftReplicatePort)

masters := cfg.GetStringSlice(cfgMasterAddrs)
if len(masters) == 0 {
return config.NewIllegalConfigError(cfgMasterAddrs)
}
for _, master := range masters {
masters = append(masters, master)
addrs := cfg.GetSlice(proto.MasterAddr)
masters := make([]string, 0, len(addrs))
for _, addr := range addrs {
masters = append(masters, addr.(string))
}
masterClient = masterSDK.NewMasterClient(masters, false)
err = m.validConfig()
Expand Down
15 changes: 8 additions & 7 deletions objectnode/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ package objectnode

import (
"context"
"github.com/chubaofs/chubaofs/proto"
"github.com/chubaofs/chubaofs/sdk/master"
"errors"
"net/http"
"regexp"
"sync"
"sync/atomic"

"github.com/chubaofs/chubaofs/proto"
"github.com/chubaofs/chubaofs/sdk/master"
"github.com/chubaofs/chubaofs/util/config"
"github.com/chubaofs/chubaofs/util/errors"
"github.com/chubaofs/chubaofs/util/log"
"github.com/gorilla/mux"
)
Expand Down Expand Up @@ -104,7 +104,7 @@ func (o *ObjectNode) Sync() {

func (o *ObjectNode) loadConfig(cfg *config.Config) (err error) {
// parse listen
listen := cfg.GetString(configListen)
listen := cfg.GetString(proto.ListenPort)
if len(listen) == 0 {
listen = defaultListen
}
Expand All @@ -125,9 +125,10 @@ func (o *ObjectNode) loadConfig(cfg *config.Config) (err error) {

// parse master config
enableHTTPS := cfg.GetBool(configEnableHTTPS)
masters := cfg.GetStringSlice(configMasters)
if len(masters) == 0 {
return config.NewIllegalConfigError(configMasters)
masterCfgs := cfg.GetSlice(proto.MasterAddr)
masters := make([]string, len(masterCfgs))
for i, masterCfg := range masterCfgs {
masters[i] = masterCfg.(string)
}
log.LogInfof("loadConfig: setup config: %v(%v)", configMasters, masters)

Expand Down
5 changes: 5 additions & 0 deletions proto/mount_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ const (
ClientKey = "clientKey"
TicketHost = "ticketHost"
EnableHTTPS = "enableHTTPS"


ListenPort = "listen"
)


0 comments on commit 60f16ed

Please sign in to comment.