-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
How to change replication-factor of topic #1238
Comments
Looks like it should work. Are you still facing this issue, if not, can you please close this issue? |
I'm not working on this recently. I'll try later again, thanks. |
I'd like to re-open this. Getting the same error "Unknown topic config name: ReplicationFactor". Sarama version: 1.26.0 |
is this even supported by the kafka admin API? |
as far I know in order to change the replication factor you'll need to:
the sarama admin example is misleading, there is no support for changing a topic's replication factor on the fly |
@DoubleLuck @sladkoff I also have tested the It's working for me with: err = admin.CreatePartitions(TestSinglePartitionTopic, 7, nil, false)
if err != nil { kafkacat -Lb localhost:9092
Metadata for all topics (from broker -1: localhost:9092/bootstrap):
1 brokers:
broker 1001 at kafka:9092 (controller)
3 topics:
topic "test.1.nokey" with 7 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
partition 1, leader 1001, replicas: 1001, isrs: 1001
partition 2, leader 1001, replicas: 1001, isrs: 1001
partition 3, leader 1001, replicas: 1001, isrs: 1001
partition 4, leader 1001, replicas: 1001, isrs: 1001
partition 5, leader 1001, replicas: 1001, isrs: 1001
partition 6, leader 1001, replicas: 1001, isrs: 1001 or using and assignment plan: number of brokers: 1 target: You'll need to provide an assignment plan for the new partitions (3 new partitions) err = admin.CreatePartitions(TestSinglePartitionTopic, 4, [][]int32{{1001}, {1001}, {1001}}, false)
if err != nil {
fmt.Printf(" >>> kafkabridge_integration_test.go/: err: %T: %+v\n", err, err)
} current assignment after the change: ╰─○ kafkacat -Lb localhost:9092
Metadata for all topics (from broker -1: localhost:9092/bootstrap):
1 brokers:
broker 1001 at kafka:9092 (controller)
3 topics:
topic "test.1.nokey" with 4 partitions:
partition 0, leader 1001, replicas: 1001, isrs: 1001
partition 1, leader 1001, replicas: 1001, isrs: 1001
partition 2, leader 1001, replicas: 1001, isrs: 1001
partition 3, leader 1001, replicas: 1001, isrs: 1001 I think this could be in the docs, it's not straightforward to infer this, took me a bit no understand it. |
@d1egoaz How can we use this to change the replica assignment for existing partitions? In your comment you create new partitions for the new assignment - your initial partition replication assignment is unchanged, isn't it? Assume I have three broker IDS I want to update the assignment for these partitions to If I call // assignment: [[1,2,3], [1,2,3], [1,2,3]]
admin.CreatePartitions("test-topic", 3, assignment, false) I get error I tried adding a new partition while also changing the replica assignment for all (now 4) partitions. Then I get the following error:
It seems to me that it's only possible to set the replication assignment for new partitions which isn't sufficient. Can you verify this? |
I'm assuming that the AlterPartitionReassignments needs to be implemented in order to edit assignments for existing partitions. @d1egoaz I'd like to try and contribute this if you agree that this is the way to continue. |
That'd be awesome! go for it! |
Hi all, I try to use sarama to increase replication-factor of topic , but didn't success, I need your help.
Versions
Sarama Version: 97315fe
Kafka Version: 1.0.0 (scala 2.12)
Go Version: 1.11 (windows/amd64)
Configuration
Sarama Config:
config.Version = sarama.V1_0_0_0
Kafka Config: 3 brokers on local CentOS, id : 0 , 1, 2
Topic Info: test444 partition 1 replication-factor 1
I hava set sarama.Logger
Step1
Step2
("test444", 1, [[0, 1]], false)
("test444", 3, [[0, 1], [1,2], [2,0]], false)
("test444", 3, [[0, 1], [1,2]], false)
Maybe I pass wrong parameters or use incorrect configs, I didn't increase the replication-factor successfully. Please help me , THANK YOU!
The text was updated successfully, but these errors were encountered: