Giter Site home page Giter Site logo

travisjeffery / jocko Goto Github PK

View Code? Open in Web Editor NEW
4.9K 227.0 362.0 11 MB

Kafka implemented in Golang with built-in coordination (No ZK dep, single binary install, Cloud Native)

Home Page: https://twitter.com/travisjeffery

License: MIT License

Go 99.62% Makefile 0.17% Shell 0.07% Dockerfile 0.13%
kafka distributed-systems queue messaging go streaming

jocko's Introduction

Jocko

ci gitter codecov

Kafka/distributed commit log service in Go.

Goals of this project:

  • Implement Kafka in Go
  • Protocol compatible with Kafka so Kafka clients and services work with Jocko
  • Make operating simpler
  • Distribute a single binary
  • Use Serf for discovery, Raft for consensus (and remove the need to run ZooKeeper)
  • Smarter configuration settings
    • Able to use percentages of disk space for retention policies rather than only bytes and time kept
    • Handling size configs when you change the number of partitions or add topics
  • Learn a lot and have fun

TODO

  • Producing
  • Fetching
  • Partition consensus and distribution
  • Protocol
    • Produce
    • Fetch
    • Metadata
    • Create Topics
    • Delete Topics
    • Consumer group [current task]
  • Discovery
  • API versioning [more API versions to implement]
  • Replication [first draft done - testing heavily now]

Hiatus Writing Book

I’m writing a book for PragProg called Building Distributed Services with Go. You can sign up on this mailing list and get updated when the book’s available. It walks you through building a distributed commit log from scratch. I hope it will help Jocko contributors and people who want to work on distributed services.

Reading

Project Layout

├── broker        broker subsystem
├── cmd           commands
│   └── jocko     command to run a Jocko broker and manage topics
├── commitlog     low-level commit log implementation
├── examples      examples running/using Jocko
│   ├── cluster   example booting up a 3-broker Jocko cluster
│   └── sarama    example producing/consuming with Sarama
├── protocol      golang implementation of Kafka's protocol
├── prometheus    wrapper around Prometheus' client lib to handle metrics
├── server        API subsystem
└── testutil      test utils
    └── mock      mocks of the various subsystems

Building

Local

  1. Clone Jocko

    $ go get github.com/travisjeffery/jocko
    
  2. Build Jocko

    $ cd $GOPATH/src/github.com/travisjeffery/jocko
    $ make build
    

    (If you see an error about dep not being found, ensure that $GOPATH/bin is in your PATH)

Docker

docker build -t travisjeffery/jocko:latest .

Contributing

See CONTRIBUTING for details on submitting patches and the contribution workflow.

License

Jocko is under the MIT license, see the LICENSE file for details.


jocko's People

Contributors

basph avatar beastawakens avatar candlerb avatar gamingcoder avatar gitter-badger avatar keijiyoshida avatar klavs avatar llonchj avatar mramshaw avatar mrcrgl avatar ryanstinson avatar shwetabhgarg avatar thinkerou avatar thinxer avatar transitorykris avatar travisjeffery avatar tylertreat avatar wanlitian avatar zorkian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jocko's Issues

suspect usage of sort.Search

I was reading the source and came across this in commitlog/util.go:

func findSegment(segments []*Segment, offset int64) (*Segment, int) {
	idx := sort.Search(len(segments), func(i int) bool {
		return segments[i].BaseOffset > offset
	}) - 1

	if idx < 0 {
		return nil, idx
	}

	return segments[idx], idx
}

The documentation for sort.Search says:

Search returns the first true index. If there is no such index, Search returns n. (Note that the "not found" return value is not -1 as in, for instance, strings.Index.)

So intuitively it appears that this code should check for idx == len(segments). Or if you take into account the -1 in the code listed above it would be idx == len(segments)-1.

I found another usage of sort.Search in commitlog/segment.go (findEntry) that also doesn't check this condition.

go get github.com/travisjeffery/jocko fails

This is the first command described in examples/cluster.

Following error message:

package github.com/travisjeffery/jocko: no buildable Go source files in /go/src/github.com/travisjeffery/jocko

I want to run jocko in docker but it fails on the first command. The same command fails on macOS and I testet multiple go versions from 1.6.4 to 1.8rc2.

There is my used docker file for reproduction purpose:

FROM golang:1.7.4-alpine

RUN apk --no-cache add git

RUN go get github.com/travisjeffery/jocko

Hide Serf and Raft from Broker

Issue: Broker struct is over-burdened.
Proposal: Hide details of serf and raft from Broker behind interfaces
Potential benefits?:

  1. Responsibility of broker package becomes leaner, making it easier to navigate
  2. Easier to write fine-grained tests of functionalities by mocking out serf and raft interfaces, and separate testing for serf and raft functionalities

Code changes proposal: Feature branch
This change set moves serf/raft code from broker to outside. All tests pass.
Next steps (todo):

  • write tests by mocking out serf and raft

add fully static linked build target to makefile and refactor Dockerfile and docker-compose.yml

. add build-static target to Makefile to build fully static linked binary.
. refactor Dockerfile, since using build-static, we don't need alpine/muslc toolchain which IMHO mostly solve cgo/glibc dependence. For multistage dockerfile, use standard golang image for first build stage and "scratch" or "busybox" as base for final deploy which results an image half size of original alpine based image.
. refactor docker-compose.yml with more consistent image names.

Getting i/o timeout for any attempt to read from broker

Hi,

I'm having a hard time to get Jocko working properly. I've attempted to run it in 2 scenarios, bot of which resulted with the same error - i/o timeout when trying to work with broker. I'm running this within Ubuntu Virtualbox on Windows host with firewall disabled.

  1. Running example Samara application as it's commited in this repo:
vagrant@homestead:~/gospace/src/github.com/travisjeffery/jocko/examples/sarama$ go run main.go
2017/03/17 10:04:59 [INFO] serf: EventMemberJoin: jocko-000 127.0.0.1
2017-03-17 10:04:59 [INFO] jocko: adding peer: &{%!s(int32=0) %!s(int=9092) 127.0.0.1 %!s(int=0) %!s(int=9093) %!s(jocko.MemberStatus=1) <nil>}
2017/03/17 10:04:59 [INFO] raft: Node at 127.0.0.1:9093 [Leader] entering Leader state
2017-03-17 10:04:59 [INFO] jocko: cluster leadership acquired
2017/03/17 10:04:59 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017-03-17 10:04:59 [DEBUG] jocko: broker/apply cmd [0]
[Sarama] 2017/03/17 10:04:59 Initializing new client
[Sarama] 2017/03/17 10:04:59 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[Sarama] 2017/03/17 10:04:59 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[Sarama] 2017/03/17 10:04:59 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:04:59 Connected to broker at 127.0.0.1:9092 (unregistered)
[Sarama] 2017/03/17 10:05:29 client/metadata got error from broker while fetching metadata: read tcp 127.0.0.1:38030->127.0.0.1:9092: i/o timeout
[Sarama] 2017/03/17 10:05:29 Closed connection to broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:05:29 client/metadata no available broker to send metadata request to
[Sarama] 2017/03/17 10:05:29 client/brokers resurrecting 1 dead seed brokers
[Sarama] 2017/03/17 10:05:29 client/metadata retrying after 250ms... (3 attempts remaining)
[Sarama] 2017/03/17 10:05:30 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[Sarama] 2017/03/17 10:05:30 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:05:30 Connected to broker at 127.0.0.1:9092 (unregistered)
[Sarama] 2017/03/17 10:06:00 client/metadata got error from broker while fetching metadata: read tcp 127.0.0.1:38044->127.0.0.1:9092: i/o timeout
[Sarama] 2017/03/17 10:06:00 Closed connection to broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:06:00 client/metadata no available broker to send metadata request to
[Sarama] 2017/03/17 10:06:00 client/brokers resurrecting 1 dead seed brokers
[Sarama] 2017/03/17 10:06:00 client/metadata retrying after 250ms... (2 attempts remaining)
[Sarama] 2017/03/17 10:06:00 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[Sarama] 2017/03/17 10:06:00 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:06:00 Connected to broker at 127.0.0.1:9092 (unregistered)
[Sarama] 2017/03/17 10:06:30 client/metadata got error from broker while fetching metadata: read tcp 127.0.0.1:38058->127.0.0.1:9092: i/o timeout
[Sarama] 2017/03/17 10:06:30 Closed connection to broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:06:30 client/metadata no available broker to send metadata request to
[Sarama] 2017/03/17 10:06:30 client/brokers resurrecting 1 dead seed brokers
[Sarama] 2017/03/17 10:06:30 client/metadata retrying after 250ms... (1 attempts remaining)
[Sarama] 2017/03/17 10:06:30 ClientID is the default of 'sarama', you should consider setting it to something application-specific.
[Sarama] 2017/03/17 10:06:30 client/metadata fetching metadata for all topics from broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:06:30 Connected to broker at 127.0.0.1:9092 (unregistered)
[Sarama] 2017/03/17 10:07:00 client/metadata got error from broker while fetching metadata: read tcp 127.0.0.1:38072->127.0.0.1:9092: i/o timeout
[Sarama] 2017/03/17 10:07:00 Closed connection to broker 127.0.0.1:9092
[Sarama] 2017/03/17 10:07:00 client/metadata no available broker to send metadata request to
[Sarama] 2017/03/17 10:07:00 client/brokers resurrecting 1 dead seed brokers
[Sarama] 2017/03/17 10:07:00 Closing Client
panic: kafka: client has run out of available brokers to talk to (Is your cluster reachable?)

goroutine 1 [running]:
main.main()
        /home/vagrant/gospace/src/github.com/travisjeffery/jocko/examples/sarama/main.go:48 +0x1bc
exit status 2
  1. Standalone Jocko instance running with Samara client connecting from Windows host application:
vagrant@homestead:~/gospace/src/github.com/travisjeffery/jocko/cmd/jocko$ ./jocko
2017/03/17 10:11:59 [INFO] serf: EventMemberJoin: jocko-000 127.0.0.1
2017-03-17 10:11:59 [INFO] jocko: adding peer: &{%!s(int32=0) %!s(int=9092) 127.0.0.1 %!s(int=0) %!s(int=9093) %!s(jocko.MemberStatus=1) <nil>}
2017/03/17 10:11:59 [INFO] raft: Node at 127.0.0.1:9093 [Leader] entering Leader state
2017/03/17 10:11:59 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017-03-17 10:11:59 [INFO] jocko: cluster leadership acquired
2017-03-17 10:12:38 [INFO] jocko: Conn read failed: read tcp 192.168.10.10:9092->192.168.10.1:51712: i/o timeout
func newProducer(brokerList []string) (sarama.SyncProducer, error) {
	config := sarama.NewConfig()
	config.Producer.RequiredAcks = sarama.WaitForLocal
	config.Producer.Compression = sarama.CompressionSnappy
	config.Producer.Flush.Frequency = 500 * time.Millisecond
	config.Producer.Return.Successes = true

	producer, err := sarama.NewSyncProducer(brokerList, config) // brokerList: []string{"127.0.0.1:9092"}
	if err != nil {
		return nil, err
	}

	return producer, nil
}

The Conn read failed was returned after I started my application and it tried to create a SyncProducer.

I'm getting the same error when using AsyncProducer. I'm almost certain that this is something with my environment, otherwise it would popped up already, but I cannot just figure what it is. In both cases it connected to the broker, because otherwise I would be getting unreachable cluster error.

Haven't you seen such error when you developed/tested jocko?

Any Documentation or Tutorials?

Hi, I never use any messaging system before. How can I use jocko? Where to start? What is the recommended client? I am very confused. Thanks.

panic: kafka: response did not contain all the expected topic/partition blocks

https://github.com/gertcuykens/jocko/blob/master/examples/sarama/main.go

Run server seperatly

% make run
rm -rf /tmp/jocko/*
jocko broker \
                --debug \
                --log-dir="/tmp/jocko" \
                --broker-addr=127.0.0.1:9092 \
                --raft-addr=127.0.0.1:9093 \
                --serf-addr=127.0.0.1:9094 \
                --http-addr=127.0.0.1:9095 \
                --id=1
2017/11/05 03:08:35 [INFO] serf: EventMemberJoin: jocko-001 127.0.0.1
2017-11-05 03:08:35 [INFO] jocko: adding peer: &{ID:1 Port:9092 IP:127.0.0.1 SerfPort:0 RaftPort:9093 Status:1 conn:<nil>}
2017/11/05 03:08:35 [INFO] raft: Node at 127.0.0.1:9093 [Leader] entering Leader state
2017-11-05 03:08:35 [INFO] jocko: cluster leadership acquired
2017/11/05 03:08:35 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]

go run main.go multiple times until panic: kafka: response did not contain all the expected topic/partition blocks

% go run main.go
Hello from Jocko #1! 0
msg partition [3] offset [0]
2017/11/05 03:03:24 msg is ok! partition: 3, offset: 0
i: 1, len: 2
still checking partition: 3
Hello from Jocko #12! 1
msg partition [3] offset [1]
2017/11/05 03:03:24 msg is ok! partition: 3, offset: 1
i: 2, len: 2
checked partition: 3
Hello from Jocko #2! 0
msg partition [0] offset [0]
2017/11/05 03:03:24 msg is ok! partition: 0, offset: 0
i: 1, len: 3
still checking partition: 0
Hello from Jocko #7! 1
msg partition [0] offset [1]
2017/11/05 03:03:24 msg is ok! partition: 0, offset: 1
i: 2, len: 3
still checking partition: 0
Hello from Jocko #13! 2
msg partition [0] offset [2]
2017/11/05 03:03:24 msg is ok! partition: 0, offset: 2
i: 3, len: 3
checked partition: 0
Hello from Jocko #3! 0
msg partition [1] offset [0]
2017/11/05 03:03:24 msg is ok! partition: 1, offset: 0
i: 1, len: 1
checked partition: 1
Hello from Jocko #5! 0
msg partition [5] offset [0]
2017/11/05 03:03:24 msg is ok! partition: 5, offset: 0
i: 1, len: 3
still checking partition: 5
Hello from Jocko #10! 1
msg partition [5] offset [1]
2017/11/05 03:03:24 msg is ok! partition: 5, offset: 1
i: 2, len: 3
still checking partition: 5
Hello from Jocko #14! 2
msg partition [5] offset [2]
2017/11/05 03:03:24 msg is ok! partition: 5, offset: 2
i: 3, len: 3
checked partition: 5
Hello from Jocko #9! 0
msg partition [2] offset [0]
2017/11/05 03:03:24 msg is ok! partition: 2, offset: 0
i: 1, len: 2
still checking partition: 2
Hello from Jocko #11! 1
msg partition [2] offset [1]
2017/11/05 03:03:24 msg is ok! partition: 2, offset: 1
i: 2, len: 2
checked partition: 2
Hello from Jocko #0! 0
msg partition [4] offset [0]
2017/11/05 03:03:24 msg is ok! partition: 4, offset: 0
i: 1, len: 4
still checking partition: 4
Hello from Jocko #4! 1
msg partition [4] offset [1]
2017/11/05 03:03:24 msg is ok! partition: 4, offset: 1
i: 2, len: 4
still checking partition: 4
Hello from Jocko #6! 2
msg partition [4] offset [2]
2017/11/05 03:03:24 msg is ok! partition: 4, offset: 2
i: 3, len: 4
still checking partition: 4
Hello from Jocko #8! 3
msg partition [4] offset [3]
2017/11/05 03:03:24 msg is ok! partition: 4, offset: 3
i: 4, len: 4
checked partition: 4
producer and consumer worked! 15 messages ok
% go run main.go
Hello from Jocko #3! 0
msg partition [1] offset [0]
2017/11/05 03:03:47 msg value not equal! partition 1, offset: 0!
exit status 1
% go run main.go
Hello from Jocko #3! 0
msg partition [1] offset [0]
2017/11/05 03:04:02 msg value not equal! partition 1, offset: 0!
exit status 1
% go run main.go
Hello from Jocko #0! 0
msg partition [4] offset [0]
2017/11/05 03:04:36 msg value not equal! partition 4, offset: 0!
exit status 1
% go run main.go
Hello from Jocko #2! 0
msg partition [0] offset [0]
2017/11/05 03:04:39 msg value not equal! partition 0, offset: 0!
exit status 1
% go run main.go
panic: kafka: response did not contain all the expected topic/partition blocks

goroutine 1 [running]:
main.main()
        /Users/gert/go/src/github.com/travisjeffery/jocko/examples/sarama/main.go:56 +0x1064
exit status 2
% go run main.go

server

2017-11-05 03:04:42 [DEBUG] jocko: request: correlation id [4], client id [sarama], request size [104], key [0]
2017-11-05 03:04:42 [INFO] jocko: commitlog/append failed: none
2017-11-05 03:04:42 [DEBUG] jocko: response: correlation id [4], key [0]
2017-11-05 03:04:50 [DEBUG] jocko: request: correlation id [1298498081], client id [cmd/createtopic], request size [59], key [19]
2017-11-05 03:04:50 [DEBUG] jocko: response: correlation id [1298498081], key [19]
2017-11-05 03:04:50 [DEBUG] jocko: request: correlation id [0], client id [sarama], request size [20], key [3]
2017-11-05 03:04:50 [DEBUG] jocko: response: correlation id [0], key [3]
2017-11-05 03:04:50 [DEBUG] jocko: request: correlation id [0], client id [sarama], request size [104], key [0]
2017-11-05 03:04:50 [DEBUG] jocko: response: correlation id [0], key [0]
2017-11-05 03:04:50 [DEBUG] jocko: request: correlation id [1], client id [sarama], request size [104], key [0]
2017-11-05 03:04:50 [DEBUG] jocko: response: correlation id [1], key [0]
2017-11-05 03:04:50 [DEBUG] jocko: request: correlation id [2], client id [sarama], request size [104], key [0]
2017-11-05 03:04:50 [DEBUG] jocko: response: correlation id [2], key [0]
2017-11-05 03:04:50 [DEBUG] jocko: request: correlation id [3], client id [sarama], request size [104], key [0]
2017-11-05 03:04:50 [INFO] jocko: commitlog/append failed: none
2017-11-05 03:04:50 [DEBUG] jocko: response: correlation id [3], key [0]

A malicious? client will crash jocko

curl localhost:9092

produces:

panic: read tcp [::1]:9092->[::1]:52133: i/o timeout

goroutine 45 [running]:
github.com/travisjeffery/jocko/server.(*Server).handleRequest(0xc420017680, 0x18d45e0, 0xc42008a040)
	/Users/llonchj/go/src/github.com/travisjeffery/jocko/server/server.go:132 +0xee6
created by github.com/travisjeffery/jocko/server.(*Server).Start.func1
	/Users/llonchj/go/src/github.com/travisjeffery/jocko/server/server.go:75 +0x119
exit status 2```

docker build fails: build output "jocko" already exists and is a directory

Trying jocko for the first time, with current HEAD f5d7996, ubuntu 16.04, docker-ce 18.03.0ce-0ubuntu

# docker build .
Sending build context to Docker daemon  5.467MB
Step 1/10 : FROM golang:1.9-alpine
...
Step 5/10 : RUN GOOS=linux GOARCH=amd64 make deps build
 ---> Running in 667ac5806191
/go/bin/dep
Warning: the following project(s) have [[constraint]] stanzas in Gopkg.toml:

  ✗  github.com/gorilla/handlers
  ✗  github.com/gorilla/mux
  ✗  github.com/prometheus/client_golang

However, these projects are not direct dependencies of the current project:
they are not imported in any .go files, nor are they in the 'required' list in
Gopkg.toml. Dep only applies [[constraint]] rules to direct dependencies, so
these rules will have no effect.

Either import/require packages from these projects so that they become direct
dependencies, or convert each [[constraint]] to an [[override]] to enforce rules
on these projects, if they happen to be transitive dependencies.

<< pauses here for a while >>
go install command-line-arguments: build output "jocko" already exists and is a directory
make: *** [Makefile:14: build] Error 1
The command '/bin/sh -c GOOS=linux GOARCH=amd64 make deps build' returned a non-zero code: 2

IRC/Gitter/Slack community

Hello,

i like ur project. i love kafka but i hate zookeeper and i hata java. and then i found this. i think it has potential.

i think you should make a homepage/website and maby a IRC/Gitter/slack channel where people can hangout and talk. form a community of users cause #apache-kafka on irc is pretty dead

How far are you?/how stable is it for production use?

Go install fails with Go 1.8.3 on Darwin

I was trying to install the binary and got this error:

$ go install github.com/travisjeffery/jocko

# github.com/travisjeffery/jocko
./jocko.go:33: syntax error: unexpected = in type declaration

$ go version:

go version go1.8.3 darwin/amd64

Have you thought of doing releases of the binary through GitHub? We do this on OpenFaaS and you're welcome to cookie-cut the process, it's immensely useful. ( example: https://github.com/openfaas/faas-cli )

broker tests

I have started on thoroughly testing the broker. I finished the New Broker tests and will be creating a PR for that first. Let me know what you think about the approach. I like the way you laid out a template for the tests. I tried to follow that as best I could.

error while applying raft command: {1 0xc420123240}

/Users/gert/go/src/github.com/travisjeffery/jocko/examples/sarama
% go run main.go
2017/11/04 00:42:15 [INFO] serf: EventMemberJoin: jocko-000 127.0.0.1
2017-11-04 00:42:15 [INFO] jocko: adding peer: &{ID:0 Port:9092 IP:127.0.0.1 SerfPort:0 RaftPort:9093 Status:1 conn:<nil>}
2017/11/04 00:42:15 [INFO] raft: Node at 127.0.0.1:9093 [Leader] entering Leader state
2017-11-04 00:42:15 [INFO] jocko: cluster leadership acquired
2017/11/04 00:42:15 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017-11-04 00:42:15 [DEBUG] jocko: request: correlation id [1012491186], client id [cmd/createtopic], request size [59], key [19]
2017-11-04 00:42:15 [DEBUG] jocko: broker/apply cmd 1:
&{"topic":"test_topic","id":0,"replicas":[0],"isr":[0],"leader":0,"preferred_leader":0}
2017-11-04 00:42:15 [INFO] jocko: error while applying raft command: {1 0xc420123240}
2017-11-04 00:42:15 [INFO] jocko: shutting down broker
2017/11/04 00:42:15 [INFO] serf: EventMemberLeave: jocko-000 127.0.0.1
2017-11-04 00:42:15 [INFO] jocko: preparing to leave raft peers
2017-11-04 00:42:15 [DEBUG] jocko: response: correlation id [1012491186], key [19]
error code: unknown
exit status 1
%

producing consistently fails: "In the middle of a leadership election"

Even for a cluster with only a single broker (which reported acquiring cluster leadership long before).

https://gist.github.com/teepark/1ca069575e74fa0959adcafdb37ac3e6

Aside: I couldn't figure out how to create a topic either -- kafka-topics.sh from the Kafka distribution requires a zookeeper url. So this producer client was just hoping and praying for the auto-create functionality that Kafka can do. Maybe the real error is the topic doesn't exist and it's just an issue with identifying the problem?

clean up cmdline arguments & defaults

The main package command line arguments are currently done in a mix of styles:

  • tcpaddr is an ip:port address with no default
  • raftaddr and raftport together form the bind location for the raft protocol
  • serfport is just the port with a default value -- the IP is hard-coded to 0.0.0.0.
  • raftdir is actually ignored, instead logdir/raft is always used

I propose getting rid of raftdir, and standardizing on ip:port arguments with defaults serving on all interfaces (0.0.0.0). Ideally the beginner, experimenting, can get started with a single-node cluster by just running jocko.

Would you accept a PR like this?

some errors on mac

Hey,

I loved the idea of this project. I used the quickstart steps on my mac, but it failed with some errors on the build and go get. I tracked the issue down to this issue on the jaeger client -> jaegertracing/jaeger-client-go#184

I think we may need to a "glide install" (not sure what that means) or use a specific commit of thrift before the interface changed. There was some kind of error with cobra I think, but I cant find it now. Also, could you walk me through how to contribute as I am new to the open source thing.

Thanks

Please consider adding vendor dir to next release

Hi!

I am developing a port for FreeBSD where network access is not allowed during build phase. Thus I have no possibility of running go get or deps ensure. Therefor it would be very cool if vendor dir could be added. It would not only benefit FreeBSD, but it'd ensure consistency with other operating systems as well.

How you can contribute today

Thank you for wanting to hack on Jocko and for your contributions.

Why you should hack on Jocko:

  • You'll learn a lot. I learned a ton writing the initial version of Jocko. A helluva more than had I spent the same time reading what someone else had made or put in a textbook, likely having never made anything themselves. When you do need to look up something in a textbook, and you'll want to at times, you'll have a real need for the knowledge - it'll make the difference in your favor of solving your problem at hand.
  • It's good for the resume. In the first few months of Jocko's life a contributor leveled up in their career and hacking on Jocko helped make that happen. You'll have Go, Kafka, distributed, and big data systems experience.
  • It's fun. Especially if you're looking for a non-Java big data project to hack on, you have few options. I dunno about you but I'd rather have someone slam my head in a door than hack on Java in my spare time – especially on a big old decrepit code base. Here we've got a young Go code base, nimble, and hungry to be developed into something big.

Be sure to join the #jocko room in the Gopher's Slack.

Some tracts of work you can hack on:

Tests

Who should work on this? If you want something to get started hacking, something quick, and learn how Jocko works.

  • Adding more unit and performance tests in-particular would be peachy.
  • We need a test tool like kafka-producer-perf-test.
  • Squash the bugs.
  • (Documentation too where needed, but try to write code clear enough it doesn't need docs.)

API versioning

Who should work on this? After you've hacked on tests and know Jocko's code, this is the next step.

  • This way we can handle other clients. Jocko was developed to test against Sarama but works well with kafkacat too.
  • An example to look at how to implement is how Sarama does it.

Consumer groups

Who should work on this? Don't go here unless you've got the time and desire to dig deep. This is a good chunk of work.

Replication

  • What I'm current working on.
  • So far I've got follower brokers consuming/replicating from the leaders.
  • The current work I'm doing is on managing/updating ISRs.

How to hack on Jocko

  • Before developing a feature, read the relevant Kafka design proposal, which you'll often find by Googling "Kafka design proposal the feature" or searching for it on this wiki. Reading the code will also help.
  • Run unit tests goes as usual, just go test.
  • To spin up Jocko and run/test a client against it: First spin up a cluster as documented. Then point your client at it. You'll likely find kafkacat useful.

Example:

# Spin up a cluster
$ go run cmd/jocko/main.go --debug \
          --logdir="/tmp/jocko1" \
          --brokeraddr=127.0.0.1:9001 \
          --raftaddr=127.0.0.1:9002 \
          --serfaddr=127.0.0.1:9003 \
          --id=1

$ go run cmd/jocko/main.go --debug \
          --logdir="/tmp/jocko2" \
          --brokeraddr=127.0.0.1:9101 \
          --raftaddr=127.0.0.1:9102 \
          --serfaddr=127.0.0.1:9103 \
          --serfmembers=127.0.0.1:9003 \
          --id=2

$ go run cmd/jocko/main.go --debug \
          --logdir="/tmp/jocko3" \
          --brokeraddr=127.0.0.1:9201 \
          --raftaddr=127.0.0.1:9202 \
          --serfaddr=127.0.0.1:9203 \
          --serfmembers=127.0.0.1:9003 \
          --id=3

# Create a topic
$  go run cmd/createtopic/main.go --brokeraddr localhost:9001 --topic test_topic --partitions 8

# Make requests you need (e.g. get the metadata)
$ kafkacat -L -b localhost:9201 -t test_topic

# Does it work???

Topics

Hi there, is there a way to set topics for a Jocko server either at runtime or through configuration options?

Error opening raft store: missing port in address

Hi,

I just followed the samara/README.md and got this error:

$ go run main.go
Error opening raft store: missing port in address
exit status 1

I'm using go version go1.7.5 darwin/amd64 on macOS Sierra 10.12.3 (16D32).

I also tried go get -u github.com/kardianos/govendor and govendor sync - inspired by your Makefile - assuming some dependency version issues but got

$ govendor sync
# cd .; git clone https://gopkg.in/alecthomas/kingpin.v2 /Users/stefanscheidt/Code/Go/.cache/govendor/gopkg.in/alecthomas/kingpin.v2
Cloning into '/Users/stefanscheidt/Code/Go/.cache/govendor/gopkg.in/alecthomas/kingpin.v2'...
error: RPC failed; HTTP 301 curl 22 The requested URL returned error: 301
fatal: The remote end hung up unexpectedly
Error: Remotes failed for:
	Failed for "gopkg.in/alecthomas/kingpin.v2" (failed to clone repo): exit status 128

panic: runtime error: slice bounds out of range

2017-04-13 22:23:45 [DEBUG] jocko: broker/apply cmd [0]
2017-04-13 22:23:46 [DEBUG] jocko: correlation id [6], request size [29], key [3]
2017-04-13 22:23:46 [DEBUG] jocko: correlation id [0], request size [61], key [1]
2017-04-13 22:23:48 [DEBUG] jocko: correlation id [7], request size [29], key [3]
2017-04-13 22:23:48 [DEBUG] jocko: correlation id [1], request size [61], key [1]
2017-04-13 22:23:50 [DEBUG] jocko: correlation id [8], request size [29], key [3]
2017-04-13 22:23:50 [DEBUG] jocko: correlation id [2], request size [61], key [1]
2017-04-13 22:23:52 [DEBUG] jocko: correlation id [9], request size [29], key [3]
2017-04-13 22:23:52 [DEBUG] jocko: correlation id [3], request size [61], key [1]
2017-04-13 22:23:54 [DEBUG] jocko: correlation id [10], request size [29], key [3]
2017-04-13 22:23:54 [DEBUG] jocko: correlation id [4], request size [61], key [1]
2017-04-13 22:23:54 [DEBUG] jocko: correlation id [0], request size [20], key [3]
2017-04-13 22:23:54 [DEBUG] jocko: correlation id [1], request size [29], key [3]
2017-04-13 22:23:54 [DEBUG] jocko: correlation id [0], request size [238], key [0]
panic: runtime error: slice bounds out of range

goroutine 48 [running]:
github.com/travisjeffery/jocko/commitlog.(*index).WriteAt(0xc4201f43c0, 0xc4201ed0c0, 0x8, 0x40, 0xa00000, 0x0)
/mygo/src/github.com/travisjeffery/jocko/commitlog/index.go:137 +0xf8
github.com/travisjeffery/jocko/commitlog.(*index).WriteEntry(0xc4201f43c0, 0x12, 0x0, 0xbf, 0xbf)
/mygo/src/github.com/travisjeffery/jocko/commitlog/index.go:102 +0x159
github.com/travisjeffery/jocko/commitlog.(*CommitLog).Append(0xc420072600, 0xc420092a33, 0xbf, 0xbf, 0x7, 0xc420066e48, 0xc42012e0b8)
/mygo/src/github.com/travisjeffery/jocko/commitlog/commitlog.go:130 +0x10f
github.com/travisjeffery/jocko.(*Partition).Append(0xc420072580, 0xc420092a33, 0xbf, 0xbf, 0xc420072501, 0x0, 0x0)
/mygo/src/github.com/travisjeffery/jocko/jocko.go:120 +0x52
github.com/travisjeffery/jocko/server.(*Server).handleProduce(0xc420056f00, 0xcd0420, 0xc42000e348, 0xc4201d8f68, 0xc4201f3b60, 0xc420206500, 0x0)
/mygo/src/github.com/travisjeffery/jocko/server/server.go:428 +0x2db
github.com/travisjeffery/jocko/server.(*Server).handleRequest(0xc420056f00, 0xcd0420, 0xc42000e348)
/mygo/src/github.com/travisjeffery/jocko/server/server.go:143 +0x8c7
created by github.com/travisjeffery/jocko/server.(*Server).Start.func1
/mygo/src/github.com/travisjeffery/jocko/server/server.go:75 +0x119

Unable to get started with example

I'm following the example cluster setup instructions described here: https://github.com/travisjeffery/jocko/tree/master/examples/cluster.

The cluster seems to startup ok. There are message about leader election and no errors.

However when I try and read or write data to it with kafkacat I get IO errors.

From kafkacat terminal:

➜  jocko git:(master) ✗ tail -f /var/log/Xorg.0.log | kafkacat -b 127.0.0.1:9001 -t xorglog -z snappy
% Auto-selecting Producer mode (use -P or -C to override)

%3|1486551458.751|FAIL|rdkafka#producer-1| [thrd:127.0.0.1:9001/bootstrap]: 127.0.0.1:9001/1: Receive failed: Disconnected
%3|1486551458.762|FAIL|rdkafka#producer-1| [thrd:127.0.0.1:9002/2]: 127.0.0.1:9002/2: Receive failed: Disconnected
^C% ERROR: Local: Broker transport failure: 127.0.0.1:9001/1: Receive failed: Disconnected
% ERROR: Local: Broker transport failure: 127.0.0.1:9002/2: Receive failed: Disconnected
%3|1486551463.762|FAIL|rdkafka#producer-1| [thrd:127.0.0.1:9003/3]: 127.0.0.1:9003/3: Receive failed: Disconnected
% ERROR: Local: Broker transport failure: 127.0.0.1:9003/3: Receive failed: Disconnected
% ERROR: Local: All broker connections are down: 3/3 brokers are down: terminating

From one of the brokers:

2017/02/08 22:04:23 [DEBUG] memberlist: Initiating push/pull sync with: 127.0.0.1:7948
2017-02-08 22:04:26 [DEBUG] jocko: correlation id [1], request size [30], key [3]
2017-02-08 22:04:31 [INFO] jocko: Conn read failed: read tcp 127.0.0.1:9001->127.0.0.1:55294: i/o timeout
2017-02-08 22:04:34 [DEBUG] jocko: correlation id [1], request size [30], key [3]
2017-02-08 22:04:34 [DEBUG] jocko: correlation id [2], request size [30], key [3]
2017-02-08 22:04:36 [DEBUG] jocko: correlation id [2], request size [30], key [3]
2017-02-08 22:04:36 [DEBUG] jocko: correlation id [3], request size [30], key [3]
2017-02-08 22:04:42 [DEBUG] jocko: correlation id [1], request size [30], key [3]
2017/02/08 22:04:47 [DEBUG] memberlist: TCP connection from=127.0.0.1:47232
2017-02-08 22:04:47 [INFO] jocko: Conn read failed: read tcp 127.0.0.1:9001->127.0.0.1:55312: i/o timeout
2017/02/08 22:04:47 [DEBUG] memberlist: TCP connection from=127.0.0.1:47238
2017-02-08 22:04:52 [INFO] jocko: Conn read failed: read tcp 127.0.0.1:9001->127.0.0.1:55320: i/o timeout
2017/02/08 22:04:53 [DEBUG] memberlist: Initiating push/pull sync with: 127.0.0.1:7948

Any ideas? What's an easy way I can test this?

Running embedded

Anyone tried or thought about using this Embedded.
It would require replacing some of the server code so it can be run inside a go routine.
Then I want to make the transport and binding agnostic using something like go-kit.

Why ?
So I can run the same thing on desktops, mobiles and servers.
No everyone's cup of tea but I run lots of apps on clients that need a background WAL and broker. The front-end then do pub sub via the background Jocko and all data is stored in the same process as Jocko.

Binding for iOS and android can be code generated easily. Desktops can use IPC for which there is a decent golang lib.

Various errors when testing with kafkacat

This is what I did:

  • Terminal 1: createtopic --topic=logs; jocko
  • Terminal 2: kafkacat -P -b 127.0.0.1:9092 -t logs -p 0
  • Terminal 3: kafkacat -C -b 127.0.0.1:9092 -t logs -p 0

I am sometimes able to send messages, but it is crashing on me with various errors:

% Reached end of topic logs [0] at offset 2
% ERROR: Topic logs [0] error: Message at offset 2 is too large to fetch, try increasing receive.message.max.bytes
%3|1490267581.359|FAIL|rdkafka#consumer-1| [thrd:127.0.0.1:9092/bootstrap]: 127.0.0.1:9092/bootstrap: Receive failed: Disconnected
%5|1490267581.359|FAIL|rdkafka#consumer-1| [thrd:127.0.0.1:9092/bootstrap]: 127.0.0.1:9092/bootstrap: Connection closed
% ERROR: Local: Broker transport failure: 127.0.0.1:9092/bootstrap: Receive failed: Disconnected
% ERROR: Local: Broker transport failure: 127.0.0.1:9092/bootstrap: Connection closed

and similar.

Is Jocko dead now?

Just wondering if this project is dead now since Travis scored a job at Confluent in March? 😛

Lots of commits every day in January, February, and then silence (almost) 😔

Testing

I'm interested in adding tests to help match necessary Kafka features and enable a trusty integration, but unsure where to start. I've run all the tests successfully through cd $GOPATH/src/github.com/travisjeffery/jocko; make, and read through a few. What is best at this early stage? @travisjeffery, I summon you!

Roadmap

Alright so here's what I think would be cool to accomplish with Jocko:

v1: Kafka ~= Jocko

v1 is get Jocko on par with Kafka 0.10.x. People should be able to switch out Kafka for Jocko and run it in prod. I head up the architecture at an analytics company that runs terabytes of data through Kafka everyday and I'd switch it out for Jocko.

So:

  • Implement Kafka in Go
    • With clean, easy to understand code.
    • Well tested.
    • Fast.
    • Just have to download a single binary to run it.

I've implemented Jocko so it understands Kafka's protocol. This way people can use Jocko with any client or service that works with Kafka. You'd have to make no code changes to switch from Kafka to Jocko.

Currently what's left is to implement consumer groups, replication, and benchmark/battle harden.

fatal error: runtime: out of memory when listing topics

At commit f50f5b4
then patching in brokerCfg.Server.BrokerAddr = brokerCfg.Broker.Addr in init in cmd/jocko/main.go to make it actually listen - no other code changes besides DevMode true

I'm using kafka-pythin with this code:

import kafka
import pprint

consumer = kafka.KafkaConsumer(group_id='test', bootstrap_servers=['localhost:9092'])
t = consumer.topics()
pprint.pprint(t)

and after ~10sec it crashes with the following stacktrace:

fatal error: runtime: out of memory

runtime stack:
runtime.throw(0xc9422b, 0x16)
	/usr/local/go/src/runtime/panic.go:619 +0x81
runtime.sysMap(0xc420600000, 0x1000000000, 0x0, 0x11182d8)
	/usr/local/go/src/runtime/mem_linux.go:216 +0x20a
runtime.(*mheap).sysAlloc(0x10fecc0, 0x1000000000, 0x7f7165bccee0)
	/usr/local/go/src/runtime/malloc.go:470 +0xd4
runtime.(*mheap).grow(0x10fecc0, 0x800000, 0x0)
	/usr/local/go/src/runtime/mheap.go:907 +0x60
runtime.(*mheap).allocSpanLocked(0x10fecc0, 0x800000, 0x11182e8, 0x7f7160b3cde8)
	/usr/local/go/src/runtime/mheap.go:820 +0x301
runtime.(*mheap).alloc_m(0x10fecc0, 0x800000, 0xffffffffffff0100, 0x7f7160b3ce18)
	/usr/local/go/src/runtime/mheap.go:686 +0x118
runtime.(*mheap).alloc.func1()
	/usr/local/go/src/runtime/mheap.go:753 +0x4d
runtime.(*mheap).alloc(0x10fecc0, 0x800000, 0x7f7160010100, 0x4159bc)
	/usr/local/go/src/runtime/mheap.go:752 +0x8a
runtime.largeAlloc(0xffffffff0, 0x450001, 0x7f7165c4c458)
	/usr/local/go/src/runtime/malloc.go:826 +0x94
runtime.mallocgc.func1()
	/usr/local/go/src/runtime/malloc.go:721 +0x46
runtime.systemstack(0x7f7100000000)
	/usr/local/go/src/runtime/asm_amd64.s:409 +0x79
runtime.mstart()
	/usr/local/go/src/runtime/proc.go:1170

goroutine 68 [running]:
runtime.systemstack_switch()
	/usr/local/go/src/runtime/asm_amd64.s:363 fp=0xc4200b7a38 sp=0xc4200b7a30 pc=0x455b10
runtime.mallocgc(0xffffffff0, 0xb403a0, 0x1, 0xb9a940)
	/usr/local/go/src/runtime/malloc.go:720 +0x8a2 fp=0xc4200b7ad8 sp=0xc4200b7a38 pc=0x411f92
runtime.makeslice(0xb403a0, 0xffffffff, 0xffffffff, 0x0, 0xc42007ec00, 0xc420226320)
	/usr/local/go/src/runtime/slice.go:61 +0x77 fp=0xc4200b7b08 sp=0xc4200b7ad8 pc=0x4416f7
github.com/travisjeffery/jocko/protocol.(*ByteDecoder).StringArray(0xc4201a6480, 0x412238, 0x20, 0xb9a940, 0x1, 0xc420178a20)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/protocol/decoder.go:245 +0x9b fp=0xc4200b7b68 sp=0xc4200b7b08 pc=0xa03eeb
github.com/travisjeffery/jocko/protocol.(*MetadataRequest).Decode(0xc420178a20, 0xd34ac0, 0xc4201a6480, 0xb403a0, 0xc420226320)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/protocol/metadata_request.go:13 +0x31 fp=0xc4200b7ba8 sp=0xc4200b7b68 pc=0xa079b1
github.com/travisjeffery/jocko/jocko.(*Server).handleRequest(0xc420244070, 0xd32b20, 0xc420192130)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/server.go:213 +0x800 fp=0xc4200b7fc8 sp=0xc4200b7ba8 pc=0xab24c0
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2361 +0x1 fp=0xc4200b7fd0 sp=0xc4200b7fc8 pc=0x4586a1
created by github.com/travisjeffery/jocko/jocko.(*Server).Start.func1
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/server.go:99 +0x345

goroutine 1 [chan receive]:
github.com/travisjeffery/jocko/vendor/github.com/tj/go-gracefully.Shutdown()
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/tj/go-gracefully/gracefully.go:21 +0x91
main.run(0xc420240000, 0x11167b8, 0x0, 0x0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/cmd/jocko/main.go:117 +0x99a
github.com/travisjeffery/jocko/vendor/github.com/spf13/cobra.(*Command).execute(0xc420240000, 0x11167b8, 0x0, 0x0, 0xc420240000, 0x11167b8)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/spf13/cobra/command.go:702 +0x2c6
github.com/travisjeffery/jocko/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0x10ecd40, 0x0, 0xc420240000, 0xc420240480)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/spf13/cobra/command.go:783 +0x2e4
github.com/travisjeffery/jocko/vendor/github.com/spf13/cobra.(*Command).Execute(0x10ecd40, 0xab7b55, 0xc42008c058)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/spf13/cobra/command.go:736 +0x2b
main.main()
	/home/florian/code/go/src/github.com/travisjeffery/jocko/cmd/jocko/main.go:161 +0x2d

goroutine 5 [syscall]:
os/signal.signal_recv(0x0)
	/usr/local/go/src/runtime/sigqueue.go:139 +0xa6
os/signal.loop()
	/usr/local/go/src/os/signal/signal_unix.go:22 +0x22
created by os/signal.init.0
	/usr/local/go/src/os/signal/signal_unix.go:28 +0x41

goroutine 35 [select]:
github.com/travisjeffery/jocko/vendor/github.com/uber/jaeger-client-go.(*remoteReporter).processQueue(0xc420238460)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/uber/jaeger-client-go/reporter.go:265 +0x13b
created by github.com/travisjeffery/jocko/vendor/github.com/uber/jaeger-client-go.NewRemoteReporter
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/uber/jaeger-client-go/reporter.go:209 +0x16b

goroutine 36 [IO wait]:
internal/poll.runtime_pollWait(0x7f7165c0fe30, 0x72, 0x0)
	/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201aaa98, 0x72, 0xc420072000, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc4201aaa98, 0xffffffffffffff00, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc4201aaa80, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:372 +0x1a8
net.(*netFD).accept(0xc4201aaa80, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc420218108, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).Accept(0xc420218108, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/tcpsock.go:259 +0x49
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*TCPStreamLayer).Accept(0xc4201a57e0, 0x0, 0x0, 0x0, 0x0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/tcp_transport.go:101 +0x2f
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*NetworkTransport).listen(0xc4201aab00)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/net_transport.go:416 +0x49
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.NewNetworkTransportWithConfig
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/net_transport.go:157 +0x172

goroutine 37 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).leaderLoop(0xc42026e2c0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/raft.go:496 +0x415
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).runLeader(0xc42026e2c0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/raft.go:416 +0x385
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).run(0xc42026e2c0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/raft.go:136 +0x67
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).(github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.run)-fm()
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/api.go:505 +0x2a
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*raftState).goFunc.func1(0xc42026e2c0, 0xc4202268e0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/state.go:146 +0x53
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*raftState).goFunc
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/state.go:144 +0x66

goroutine 38 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).runFSM(0xc42026e2c0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/fsm.go:116 +0x1e7
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).(github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.runFSM)-fm()
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/api.go:506 +0x2a
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*raftState).goFunc.func1(0xc42026e2c0, 0xc4202268f0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/state.go:146 +0x53
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*raftState).goFunc
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/state.go:144 +0x66

goroutine 39 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).runSnapshots(0xc42026e2c0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/snapshot.go:71 +0x152
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*Raft).(github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.runSnapshots)-fm()
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/api.go:507 +0x2a
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*raftState).goFunc.func1(0xc42026e2c0, 0xc420226900)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/state.go:146 +0x53
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft.(*raftState).goFunc
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/raft/state.go:144 +0x66

goroutine 40 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.(*serfQueries).stream(0xc4202d09f0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/internal_query.go:80 +0xe0
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.newSerfQueries
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/internal_query.go:73 +0xbc

goroutine 41 [IO wait]:
internal/poll.runtime_pollWait(0x7f7165c0fd60, 0x72, 0x0)
	/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201aad18, 0x72, 0xc420182700, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc4201aad18, 0xffffffffffffff00, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc4201aad00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:372 +0x1a8
net.(*netFD).accept(0xc4201aad00, 0x8, 0xc4202d8ef0, 0x0)
	/usr/local/go/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc420218148, 0x42a2c9, 0x8, 0xc4201826c0)
	/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).AcceptTCP(0xc420218148, 0xcb7a58, 0xc420244950, 0x0)
	/usr/local/go/src/net/tcpsock.go:246 +0x49
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*NetTransport).tcpListen(0xc420244930, 0xc420218148)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/net_transport.go:225 +0x5f
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.NewNetTransport
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/net_transport.go:109 +0x965

goroutine 42 [IO wait]:
internal/poll.runtime_pollWait(0x7f7165c0fc90, 0x72, 0x0)
	/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201aad98, 0x72, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc4201aad98, 0xc420310000, 0x10000, 0x10000)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).ReadFrom(0xc4201aad80, 0xc420310000, 0x10000, 0x10000, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:207 +0x17d
net.(*netFD).readFrom(0xc4201aad80, 0xc420310000, 0x10000, 0x10000, 0x0, 0x0, 0x0, 0x4119e9, 0xc4202d9668)
	/usr/local/go/src/net/fd_unix.go:208 +0x5b
net.(*UDPConn).readFrom(0xc420218158, 0xc420310000, 0x10000, 0x10000, 0x101, 0xc4202d9640, 0xc4202d96b8, 0x4416f7)
	/usr/local/go/src/net/udpsock_posix.go:47 +0x6a
net.(*UDPConn).ReadFrom(0xc420218158, 0xc420310000, 0x10000, 0x10000, 0x10000, 0x10000, 0x0, 0x0, 0x0)
	/usr/local/go/src/net/udpsock.go:118 +0x6f
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*NetTransport).udpListen(0xc420244930, 0xc420218158)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/net_transport.go:247 +0xc5
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.NewNetTransport
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/net_transport.go:110 +0x8e0

goroutine 43 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).streamListen(0xc420242690)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/net.go:190 +0x137
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.newMemberlist
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/memberlist.go:145 +0x40c

goroutine 44 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).packetListen(0xc420242690)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/net.go:270 +0x15f
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.newMemberlist
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/memberlist.go:146 +0x431

goroutine 45 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).packetHandler(0xc420242690)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/net.go:352 +0x109
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.newMemberlist
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/memberlist.go:147 +0x456

goroutine 21 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).triggerFunc(0xc420242690, 0x3b9aca00, 0xc420544000, 0xc4202c7560, 0xc420190d40)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/state.go:128 +0x1a8
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).schedule
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/state.go:94 +0x37c

goroutine 22 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).pushPullTrigger(0xc420242690, 0xc4202c7560)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/state.go:155 +0x1f6
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).schedule
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/state.go:100 +0x2d2

goroutine 49 [runnable]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).triggerFunc(0xc420242690, 0xbebc200, 0xc4201b30e0, 0xc4202c7560, 0xc420226030)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/state.go:128 +0x1a8
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist.(*Memberlist).schedule
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/memberlist/state.go:106 +0x1c8

goroutine 50 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.(*Serf).handleReap(0xc42029e900)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:1405 +0x154
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.Create
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:406 +0x956

goroutine 51 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.(*Serf).handleReconnect(0xc42029e900)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:1423 +0x101
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.Create
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:407 +0x97b

goroutine 52 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.(*Serf).checkQueueDepth(0xc42029e900, 0xc88129, 0x6, 0xc4202d0b10)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:1538 +0x100
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.Create
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:408 +0x9be

goroutine 53 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.(*Serf).checkQueueDepth(0xc42029e900, 0xc873ab, 0x5, 0xc4202d0b40)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:1538 +0x100
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.Create
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:409 +0xa04

goroutine 54 [select]:
github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.(*Serf).checkQueueDepth(0xc42029e900, 0xc8751d, 0x5, 0xc4202d0b70)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:1538 +0x100
created by github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf.Create
	/home/florian/code/go/src/github.com/travisjeffery/jocko/vendor/github.com/hashicorp/serf/serf/serf.go:410 +0xa4a

goroutine 55 [select]:
github.com/travisjeffery/jocko/jocko.(*Broker).lanEventHandler(0xc42023e180)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/serf.go:43 +0xe7
created by github.com/travisjeffery/jocko/jocko.NewBroker
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/broker.go:120 +0x6c0

goroutine 56 [select]:
github.com/travisjeffery/jocko/jocko.(*Broker).monitorLeadership(0xc42023e180)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/leader.go:123 +0x10d
created by github.com/travisjeffery/jocko/jocko.NewBroker
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/broker.go:122 +0x6e2

goroutine 57 [IO wait]:
internal/poll.runtime_pollWait(0x7f7165c0fbc0, 0x72, 0x0)
	/usr/local/go/src/runtime/netpoll.go:173 +0x57
internal/poll.(*pollDesc).wait(0xc4201aa198, 0x72, 0xc420174000, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:85 +0x9b
internal/poll.(*pollDesc).waitRead(0xc4201aa198, 0xffffffffffffff00, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_poll_runtime.go:90 +0x3d
internal/poll.(*FD).Accept(0xc4201aa180, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
	/usr/local/go/src/internal/poll/fd_unix.go:372 +0x1a8
net.(*netFD).accept(0xc4201aa180, 0xc420192130, 0x0, 0x0)
	/usr/local/go/src/net/fd_unix.go:238 +0x42
net.(*TCPListener).accept(0xc420218018, 0x454dd0, 0xc4200b3dc0, 0xc4200b3dc8)
	/usr/local/go/src/net/tcpsock_posix.go:136 +0x2e
net.(*TCPListener).Accept(0xc420218018, 0x2, 0x0, 0x0, 0xc420192130)
	/usr/local/go/src/net/tcpsock.go:259 +0x49
github.com/travisjeffery/jocko/jocko.(*Server).Start.func1(0xd2ebc0, 0xc420026148, 0xc420244070)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/server.go:93 +0x156
created by github.com/travisjeffery/jocko/jocko.(*Server).Start
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/server.go:85 +0xfd

goroutine 58 [select]:
github.com/travisjeffery/jocko/jocko.(*Server).Start.func2(0xd2ebc0, 0xc420026148, 0xc420244070)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/server.go:106 +0x16c
created by github.com/travisjeffery/jocko/jocko.(*Server).Start
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/server.go:104 +0x133

goroutine 59 [select]:
github.com/travisjeffery/jocko/jocko.(*Broker).Run(0xc42023e180, 0xd2ebc0, 0xc420026148, 0xc42016c0c0, 0xc42016c120)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/broker.go:137 +0x1e7
created by github.com/travisjeffery/jocko/jocko.(*Server).Start
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/server.go:122 +0x17f

goroutine 60 [select, locked to thread]:
runtime.gopark(0xcb7978, 0x0, 0xc88c99, 0x6, 0x18, 0x1)
	/usr/local/go/src/runtime/proc.go:291 +0x11a
runtime.selectgo(0xc420045f50, 0xc4202c61e0)
	/usr/local/go/src/runtime/select.go:392 +0xe50
runtime.ensureSigM.func1()
	/usr/local/go/src/runtime/signal_unix.go:549 +0x1f4
runtime.goexit()
	/usr/local/go/src/runtime/asm_amd64.s:2361 +0x1

goroutine 67 [select]:
github.com/travisjeffery/jocko/jocko.(*Broker).leaderLoop(0xc42023e180, 0xc4201ca1e0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/leader.go:202 +0x1ee
github.com/travisjeffery/jocko/jocko.(*Broker).monitorLeadership.func1(0xc42017c010, 0xc42023e180, 0xc4201ca1e0)
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/leader.go:135 +0x5b
created by github.com/travisjeffery/jocko/jocko.(*Broker).monitorLeadership
	/home/florian/code/go/src/github.com/travisjeffery/jocko/jocko/leader.go:133 +0x1ef
free -m
              total        used        free      shared  buff/cache   available
Mem:          15786        9186        1595         700        5003        6809
Swap:          7931           0        7931

Use latest raft

The hashicorp/raft library has reached 1.0.0 with a fair bit of changes under the hood. It would be nice if jocko can be updated to use the latest version of raft.

sarama example

Hi, the sarama example is working on its own but I don't understand how to make a test work that has jocko running on its own and then after successful start up of the service do the same example on it?

This is the code I use to split the example into two so I can use a already running Jocko service instead.
gertcuykens@39077e6

The result I get is

make run
rm -rf /tmp/jocko/*
jocko broker \
                --debug \
                --log-dir="/tmp/jocko" \
                --broker-addr=127.0.0.1:9092 \
                --raft-addr=127.0.0.1:9093 \
                --serf-addr=127.0.0.1:9094 \
                --http-addr=127.0.0.1:9095 \
                --id=1
2017/10/23 00:25:02 [INFO] serf: EventMemberJoin: jocko-001 127.0.0.1
2017-10-23 00:25:02 [INFO] jocko: adding peer: &{ID:1 Port:9092 IP:127.0.0.1 SerfPort:0 RaftPort:9093 Status:1 conn:<nil>}
2017/10/23 00:25:02 [INFO] raft: Node at 127.0.0.1:9093 [Leader] entering Leader state
2017-10-23 00:25:02 [INFO] jocko: cluster leadership acquired
2017/10/23 00:25:02 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017-10-23 00:25:16 [DEBUG] jocko: request: correlation id [50390780], client id [cmd/createtopic], request size [59], key [19]
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":0,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":1,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":2,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: response: correlation id [50390780], key [19]
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":3,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: request: correlation id [0], client id [sarama], request size [20], key [3]
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":4,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: response: correlation id [0], key [3]
2017-10-23 00:25:16 [DEBUG] jocko: request: correlation id [1], client id [sarama], request size [32], key [3]
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":5,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: response: correlation id [1], key [3]
2017-10-23 00:25:16 [DEBUG] jocko: request: correlation id [2], client id [sarama], request size [32], key [3]
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":6,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: response: correlation id [2], key [3]
2017-10-23 00:25:16 [DEBUG] jocko: request: correlation id [3], client id [sarama], request size [32], key [3]
2017-10-23 00:25:16 [DEBUG] jocko: broker/apply cmd 0:
&{"topic":"test_topic","id":7,"replicas":[1],"isr":[1],"leader":1,"preferred_leader":1}
2017-10-23 00:25:16 [DEBUG] jocko: response: correlation id [3], key [3]

on the server but on the client it goes wrong?

% go test -v
=== RUN   TestSarama
--- FAIL: TestSarama (0.01s)
panic: kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes. [recovered]
        panic: kafka server: In the middle of a leadership election, there is currently no leader for this partition and hence it is unavailable for writes.

goroutine 9 [running]:
testing.tRunner.func1(0xc4201c20f0)
        /usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:711 +0x2d2
panic(0x14e4640, 0x15eda9a)
        /usr/local/Cellar/go/1.9.1/libexec/src/runtime/panic.go:491 +0x283
github.com/travisjeffery/jocko/examples/sarama.TestSarama(0xc4201c20f0)
        /Users/gert/go/src/github.com/travisjeffery/jocko/examples/sarama/sarama_test.go:63 +0xf5e
testing.tRunner(0xc4201c20f0, 0x15af308)
        /usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:746 +0xd0
created by testing.(*T).Run
        /usr/local/Cellar/go/1.9.1/libexec/src/testing/testing.go:789 +0x2de
exit status 2
FAIL    github.com/travisjeffery/jocko/examples/sarama  0.032s
%

every restart produce a raft updated peer set

here is the initial start trace in debug mode

2017/05/12 10:09:33 [INFO] serf: EventMemberJoin: jocko-001 127.0.0.1
2017-05-12 10:09:33 [INFO] jocko: adding peer: &{ID:1 Port:9092 IP:127.0.0.1 SerfPort:0 RaftPort:9093 Status:1 conn:}
2017/05/12 10:09:33 [INFO] raft: Node at 127.0.0.1:9093 [Leader] entering Leader state
2017-05-12 10:09:33 [INFO] jocko: cluster leadership acquired
2017/05/12 10:09:33 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]

but if we stop and restarts we have as many "updeted peer set" as we restarted jocko :

2017-05-12 10:13:00 [INFO] jocko: adding peer: &{ID:1 Port:9092 IP:127.0.0.1 SerfPort:0 RaftPort:9093 Status:1 conn:}
2017/05/12 10:13:00 [INFO] serf: EventMemberJoin: jocko-001 127.0.0.1
2017-05-12 10:13:00 [INFO] jocko: cluster leadership acquired
2017/05/12 10:13:00 [INFO] raft: Node at 127.0.0.1:9093 [Leader] entering Leader state
2017/05/12 10:13:00 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017/05/12 10:13:00 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017/05/12 10:13:00 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017/05/12 10:13:00 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]
2017/05/12 10:13:00 [DEBUG] raft: Node 127.0.0.1:9093 updated peer set (2): [127.0.0.1:9093]

maybe I'm wrong but generaly this sounds like a potential problem.

Different logging library

Is there a reason for using travisjeffery/simplelog library for logging? Logrus would give us much more logging features. For jocko specific, I think different logging levels and logging output options that Logrus provides would come in handy.

Cannot run serf_test.Test_Membership()

The test Test_Membership in serf_test.go keeps failing on me with error:

--- FAIL: Test_Membership (0.01s)
        Error Trace:    serf_test.go:37
	Error:		Received unexpected error Failed to create memberlist: Could not set up network transport: Failed to start UDP listener on "0.0.0.0" port 7948: listen udp 0.0.0.0:7948: bind: address already in use

I cannot figure out why I'm getting this error. I trace the bind down to the point where it calls net.ListenUDP on UDP port 7948, set a breakpoint at this line and don't see any listening UDP connections on port 7948 at this point:

basph@MBP:~$ lsof -i -n -P | grep 794
___Test_M 6478 bas    8u  IPv6 0x21aa5a91cbda343b      0t0  TCP *:7947 (LISTEN)
___Test_M 6478 bas    9u  IPv6 0x21aa5a91c9953d5b      0t0  UDP *:7947
___Test_M 6478 bas   10u  IPv6 0x21aa5a91cbda2efb      0t0  TCP *:7948 (LISTEN)

Any ideas?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.