Make the raft logging configurable

pull/1081/merge
John Shahid 2014-10-30 16:00:01 -04:00
parent 60c98e519e
commit f9b3a27345
7 changed files with 17 additions and 1 deletions

View File

@ -79,6 +79,8 @@ port = 8090
# Where the raft logs are stored. The user running InfluxDB will need read/write access.
dir = "/tmp/influxdb/development/raft"
debug = true
# election-timeout = "1s"
[storage]

View File

@ -94,6 +94,7 @@ type UdpInputConfig struct {
type RaftConfig struct {
Port int
Dir string
Debug bool
Timeout duration `toml:"election-timeout"`
}
@ -200,6 +201,7 @@ type Configuration struct {
RaftServerPort int
RaftTimeout duration
RaftDebug bool
SeedServers []string
DataDir string
RaftDir string
@ -349,6 +351,7 @@ func parseTomlConfiguration(filename string) (*Configuration, error) {
RaftServerPort: tomlConfiguration.Raft.Port,
RaftTimeout: tomlConfiguration.Raft.Timeout,
RaftDir: tomlConfiguration.Raft.Dir,
RaftDebug: tomlConfiguration.Raft.Debug,
ProtobufPort: tomlConfiguration.Cluster.ProtobufPort,
ProtobufTimeout: tomlConfiguration.Cluster.ProtobufTimeout,
ProtobufHeartbeatInterval: tomlConfiguration.Cluster.ProtobufHeartbeatInterval,

View File

@ -56,7 +56,6 @@ var registeredCommands bool
// Creates a new server.
func NewRaftServer(config *configuration.Configuration, clusterConfig *cluster.ClusterConfiguration) *RaftServer {
// raft.SetLogLevel(raft.Debug)
if !registeredCommands {
registeredCommands = true
for _, command := range internalRaftCommands {

View File

@ -12,6 +12,7 @@ import (
"time"
log "code.google.com/p/log4go"
"github.com/influxdb/influxdb/_vendor/raft"
"github.com/influxdb/influxdb/configuration"
"github.com/influxdb/influxdb/coordinator"
"github.com/influxdb/influxdb/server"
@ -117,6 +118,11 @@ func main() {
setupLogging(config.LogLevel, config.LogFile)
if config.RaftDebug {
log.Info("Turning on raft debug logging")
raft.SetLogLevel(raft.Trace)
}
if *repairLeveldb {
log.Info("Repairing leveldb")
files, err := ioutil.ReadDir(config.DataDir)

View File

@ -47,6 +47,8 @@ port = 60501
# Where the raft logs are stored. The user running InfluxDB will need read/write access.
dir = "/tmp/influxdb/test/1/raft"
debug = true
[storage]
dir = "/tmp/influxdb/test/1/db"

View File

@ -31,6 +31,8 @@ port = 60507
# Where the raft logs are stored. The user running InfluxDB will need read/write access.
dir = "/tmp/influxdb/test/2/raft"
debug = true
[storage]
dir = "/tmp/influxdb/test/2/db"

View File

@ -31,6 +31,8 @@ port = 60511
# Where the raft logs are stored. The user running InfluxDB will need read/write access.
dir = "/tmp/influxdb/test/3/raft"
debug = true
[storage]
dir = "/tmp/influxdb/test/3/db"