linkend="sql-altersubscription-params-refresh-publication"><command>ALTER SUBSCRIPTION ... REFRESH PUBLICATION</command></link>,
e.g.:
<programlisting>
/* node2 # */ ALTER SUBSCRIPTION sub1_node1_node2 REFRESH PUBLICATION;
</programlisting>
</para>
</step>
</procedure>
<note>
<para>
In the steps described above, the publisher is upgraded first, followed
by the subscriber. Alternatively, the user can use similar steps to
upgrade the subscriber first, followed by the publisher.
</para>
</note>
</sect3>
<sect3 id="steps-cascaded-logical-replication-cluster">
<title>Steps to upgrade a cascaded logical replication cluster</title>
<para>
Let's say we have a cascaded logical replication setup
<literal>node1</literal>-><literal>node2</literal>-><literal>node3</literal>.
Here <literal>node2</literal> is subscribing the changes from
<literal>node1</literal> and <literal>node3</literal> is subscribing
the changes from <literal>node2</literal>. The <literal>node2</literal>
has a subscription <literal>sub1_node1_node2</literal> which is
subscribing the changes from <literal>node1</literal>. The
<literal>node3</literal> has a subscription
<literal>sub1_node2_node3</literal> which is subscribing the changes from
<literal>node2</literal>.
</para>
<procedure>
<step id="cascaded-cluster-disable-sub-node1-node2">
<para>
Disable all the subscriptions on <literal>node2</literal> that are
subscribing the changes from <literal>node1</literal> by using
<link linkend="sql-altersubscription-params-disable"><command>ALTER SUBSCRIPTION ... DISABLE</command></link>,
e.g.:
<programlisting>
/* node2 # */ ALTER SUBSCRIPTION sub1_node1_node2 DISABLE;
</programlisting>
</para>
</step>
<step>
<para>
Stop the server in <literal>node1</literal>, e.g.:
<programlisting>
pg_ctl -D /opt/PostgreSQL/data1 stop
</programlisting>
</para>
</step>
<step>
<para>
Initialize <literal>data1_upgraded</literal> instance by using the
required newer version.
</para>
</step>
<step>
<para>
Upgrade the <literal>node1</literal>'s server to the required newer
version, e.g.:
<programlisting>
pg_upgrade
--old-datadir "/opt/PostgreSQL/postgres/17/data1"
--new-datadir "/opt/PostgreSQL/postgres/18/data1_upgraded"
--old-bindir "/opt/PostgreSQL/postgres/17/bin"
--new-bindir "/opt/PostgreSQL/postgres/18/bin"
</programlisting>
</para>
</step>
<step>
<para>
Start the upgraded server in <literal>node1</literal>, e.g.:
<programlisting>
pg_ctl -D /opt/PostgreSQL/data1_upgraded start -l logfile
</programlisting>
</para>
</step>
<step id="cascaded-cluster-disable-sub-node2-node3">
<para>
Disable all the subscriptions on <literal>node3</literal> that are
subscribing the changes from <literal>node2</literal> by using
<link linkend="sql-altersubscription-params-disable"><command>ALTER SUBSCRIPTION ... DISABLE</command></link>,
e.g.:
<programlisting>
/* node3 # */ ALTER SUBSCRIPTION sub1_node2_node3 DISABLE;
</programlisting>
</para>
</step>
<step>
<para>
Stop the server in <literal>node2</literal>, e.g.:
<programlisting>
pg_ctl -D /opt/PostgreSQL/data2 stop
</programlisting>
</para>
</step>
<step>
<para>
Initialize <literal>data2_upgraded</literal> instance by using the
required newer version.
</para>
</step>
<step>
<para>
Upgrade the <literal>node2</literal>'s server to the required
new version, e.g.:
<programlisting>
pg_upgrade
--old-datadir "/opt/PostgreSQL/postgres/17/data2"
--new-datadir "/opt/PostgreSQL/postgres/18/data2_upgraded"