Added detailed lookup procedure of readonly topics in the PR: https://github.com/apache/pulsar/pull/11960#:~:text=A)%20Readonly%20namespace%20lookup
PTAL. --- Thanks, Haiting On 2021/10/28 12:06:44 "JiangHaiting" wrote: > The original PIP-63 doc in https://github.com/apache/pulsar/wiki/PIP-63%3A-Readonly-Topic-Ownership-Support have talked about the motivation and key changes to implement this proposal. > > > After submitting the PR (https://github.com/apache/pulsar/pull/11960), I have learned that it's not quite user-friendly to consumers if we expose the concept of readonly-namespace to clients, thanks to @penghui, @chenhang, etc. > > > Here is a new way to use this feature. And two diagrams for the cluster state change are in the attached files, please check them out. > > > For example, given a cluster called "my-cluster" with 2 brokers, 192.168.0.1 and 192.168.0.2. > It has namespace called "my-tenant/writer-namespace". > And consumers are consuming with service url "pulsar://192.168.0.1:6650, 192.168.0.2:6650" > > > Here is the steps to set up readonly namespace on a new broker 192.168.0.3. > > > 1. Set up namespace isolation policy "writer-ns-policy" to avoid assigning new broker 192.168.0.3 to writer-namespace. > > > bin/pulsar-admin ns-isolation-policy set \ > --auto-failover-policy-type min_available \ > --auto-failover-policy-params min_limit=1,usage_threshold=80 \ > --namespaces my-tenant/writer-namespace \ > --primary 192.168.0.1,192.168.0.2 my-cluster writer-ns-policy > > > 2. Create a namespaces "my-tenant/reader-namespace" and set up writerNamespace=my-tenant/writer-namespace > > > pulsar-admin namespaces create my-tenant/reader-namespace > # This is a new admin command to be added. > pulsar-admin namespaces set-writer-namespace my-tenant/writer-namespace my-tenant/reader-namespace > > > 3. Set up namespace isolation policy to assign 192.168.0.3 to reader-namespace. > > > bin/pulsar-admin ns-isolation-policy set \ > --auto-failover-policy-type min_available \ > --auto-failover-policy-params min_limit=1,usage_threshold=80 \ > --namespaces my-tenant/reader-namespace \ > --primary 192.168.0.3 my-cluster reader-ns-policy > > > 4.Update serviceUrl of some of the consumer clients to "pulsar:// 192.168.0.3:6550", and these consumers will consume messages from the readonly-namespace in 192.168.0.3 > Further more, the serviceUrl can be updated online with org.apache.pulsar.client.api.ServiceUrlProvider. > > > Most importantly, we will not expose the readonly-namespace to consumer users, and no other configuration is needed to achive this. > Once admin sets up the readonly namespace, they can update serviceUrl on their own with some external service governance mechanism. > So it's transparent to consumers. > > > > > --- > Thanks, > Haiting Jiang (Github: Jason918)