# Altering the cleanup.policy on Kafka topics in Production

**URL:** <https://forum.confluent.io/t/altering-the-cleanup-policy-on-kafka-topics-in-production/4392>\
**Category:** Ops\
**Created:** [8 March 2022 21:00 UTC](https://forum.confluent.io/t/altering-the-cleanup-policy-on-kafka-topics-in-production/4392 "2022-03-08T21:00:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jcrichfield](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@jcrichfield](https://forum.confluent.io/u/jcrichfield)\
**Post date:** [8 March 2022 21:00 UTC](https://forum.confluent.io/t/altering-the-cleanup-policy-on-kafka-topics-in-production/4392/1 "2022-03-08T21:00:08Z")

</div>

If I were update the clean up policy on a number of topics in a production Kafka instance, would it be possible without restarting the brokers? Would I need to rebalance the cluster afterwords?

Thanks,

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [9 March 2022 12:05 UTC](https://forum.confluent.io/t/altering-the-cleanup-policy-on-kafka-topics-in-production/4392/2 "2022-03-09T12:05:18Z")

</div>

hi @jcrichfield

welcome 🙂

you could change per topic settings without restarting the cluster.

example from my local docker test env:

default settings

```auto
docker exec -it kafka-1 kafka-topics --describe --topic "mytest" --bootstrap-server kafka-1:19092
Topic: mytest	TopicId: cUITkrqwQx29sRbcuPCI8Q	PartitionCount: 1	ReplicationFactor: 1	Configs: message.timestamp.type=LogAppendTime
	Topic: mytest	Partition: 0	Leader: 1	Replicas: 1	Isr: 1

```

change settings

```auto
docker exec -it kafka-1 kafka-configs --alter --bootstrap-server kafka-1:19092 --entity-type topics --entity-name mytest --add-config cleanup.policy=compact

```

new settings

```auto
docker exec -it kafka-1 kafka-topics --describe --topic mytest --bootstrap-server kafka-1:19092
Topic: mytest	TopicId: cUITkrqwQx29sRbcuPCI8Q	PartitionCount: 1	ReplicationFactor: 1 Configs: cleanup.policy=compact,message.timestamp.type=LogAppendTime
	Topic: mytest	Partition: 0	Leader: 1	Replicas: 1	Isr: 1

```

hth,  
michael

---

<div class="post-metadata">

**Author:** ![jcrichfield](https://avatars.discourse-cdn.com/v4/letter/j/ec9cab/32.png) [@jcrichfield](https://forum.confluent.io/u/jcrichfield)\
**Post date:** [9 March 2022 13:31 UTC](https://forum.confluent.io/t/altering-the-cleanup-policy-on-kafka-topics-in-production/4392/3 "2022-03-09T13:31:27Z")

</div>

Thanks for the reply. Can the --add-config modify a pre-existing setting as well?

---

<div class="post-metadata">

**Author:** ![mmuehlbeyer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mmuehlbeyer/32/1088_2.png) [@mmuehlbeyer](https://forum.confluent.io/u/mmuehlbeyer)\
**Post date:** [10 March 2022 07:43 UTC](https://forum.confluent.io/t/altering-the-cleanup-policy-on-kafka-topics-in-production/4392/4 "2022-03-10T07:43:07Z")

</div>

mhh afaik the best way is to  
delete and readd the config you’d like to change

best,  
michael
