Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replication factor is below 1 or larger than the number of available brokers. #3014

Closed
Lord-Y opened this issue Nov 18, 2021 · 5 comments · Fixed by #4786
Closed

Replication factor is below 1 or larger than the number of available brokers. #3014

Lord-Y opened this issue Nov 18, 2021 · 5 comments · Fixed by #4786
Assignees
Labels
area/rpk community kind/bug Something isn't working

Comments

@Lord-Y
Copy link

Lord-Y commented Nov 18, 2021

Version & Environment

Redpanda version: (use rpk version):

v21.10.1 (rev 8df2069e5b021a78fae75b5a4d534481d4d17f93)

Operating System (e.g. from /etc/os-release):

No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 21.10
Release:	21.10
Codename:	impish
  • Docker (use docker info):
Client:
 Context:    default
 Debug Mode: false
 Plugins:
  app: Docker App (Docker Inc., v0.9.1-beta3)
  buildx: Build with BuildKit (Docker Inc., v0.6.3-docker)
  scan: Docker Scan (Docker Inc., v0.9.0)

Server:
 Containers: 8
  Running: 3
  Paused: 0
  Stopped: 5
 Images: 3
 Server Version: 20.10.11
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 7b11cfaabd73bb80907dd23182b9347b4245eb5d
 runc version: v1.0.2-0-g52b36a2
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.13.0-21-generic
 Operating System: Ubuntu 21.10
 OSType: linux
 Architecture: x86_64
 CPUs: 16
 Total Memory: 31.32GiB
 Name: homebuntu
 ID: NOA3:MSGM:XFHN:LRDS:SON2:ZWBG:5LPQ:ACWF:DOJR:RYV7:HFZ7:RWIB
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

What went wrong?

Hello guys, following the documentation Setup a 3-node cluster I cannot create a topic with a replication factor of 2:

rpk topic create test -r 2 -p 1
TOPIC  STATUS
test   INVALID_REPLICATION_FACTOR: Replication factor is below 1 or larger than the number of available brokers.

I also tried this but of course no luck:

rpk topic create test -r 2 -p 1 --brokers 127.0.0.1:9092,127.0.0.1:9093,127.0.0.1:9094
rpk cluster info
BROKERS
=======
ID    HOST       PORT
0*    127.0.0.1  9092
1     127.0.0.1  9093
2     127.0.0.1  9094
rpk cluster metadata
BROKERS
=======
ID    HOST       PORT
0*    127.0.0.1  9092
1     127.0.0.1  9093
2     127.0.0.1  9094

Is it really a bug or am I doing something wrong?

@Lord-Y Lord-Y added the kind/bug Something isn't working label Nov 18, 2021
@dotnwat
Copy link
Member

dotnwat commented Nov 18, 2021

hey @Lord-Y you'll need to use an odd number (-r 1 or -r 3) for the replication factor. The reason or this is our use of the quorum based replication protocol raft.

@Lord-Y
Copy link
Author

Lord-Y commented Nov 18, 2021

@dotnwat Thx for the quick answer. It works :).

rpk topic create test -r 3 -p 1
TOPIC  STATUS
test   OK
rpk topic describe test
SUMMARY
=======
NAME        test
PARTITIONS  1
REPLICAS    3

CONFIGS
=======
KEY                     VALUE                          SOURCE
cleanup.policy          delete                         DYNAMIC_TOPIC_CONFIG
compression.type        producer                       DEFAULT_CONFIG
message.timestamp.type  CreateTime                     DEFAULT_CONFIG
partition_count         1                              DYNAMIC_TOPIC_CONFIG
redpanda.datapolicy     function_name:  script_name:   DEFAULT_CONFIG
replication_factor      3                              DYNAMIC_TOPIC_CONFIG
retention.bytes         -1                             DEFAULT_CONFIG
retention.ms            604800000                      DEFAULT_CONFIG
segment.bytes           1073741824                     DEFAULT_CONFIG

Do you want me to make a PR to add it in the troubleshooting section or in Set up a 3-node cluster or you to take care of it?
I'm sure others will ask for the same question.

@dotnwat
Copy link
Member

dotnwat commented Nov 18, 2021

Nice. Yes that does seem like something that should be in the docs as it is not obvious. I'd say it'd be safe to submit a PR that updates the troubleshooting section. I think it's debatable if it should go in the basic tutorial, but the docs reviewer can provide feedback on that.

@twmb
Copy link
Contributor

twmb commented May 16, 2022

We just added some clearer wording for negative partitions or too many partitions, we can extend that wording to cover this issue (see #4662, #4017)

@r-vasquez
Copy link
Contributor

/backport v22.1.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rpk community kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants