# Pt-osc change --host value from localhost to IP

**URL:** <https://forums.percona.com/t/pt-osc-change-host-value-from-localhost-to-ip/34584>\
**Category:** MySQL & MariaDB\
**Tags:** mysql, percona\
**Created:** [October 25, 2024, 2:46am UTC](https://forums.percona.com/t/pt-osc-change-host-value-from-localhost-to-ip/34584 "2024-10-25T02:46:35Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![B\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/b_a/32/13324_2.png) [@B\_A](https://forums.percona.com/u/B_A)\
**Post date:** [October 25, 2024, 2:46am UTC](https://forums.percona.com/t/pt-osc-change-host-value-from-localhost-to-ip/34584/1 "2024-10-25T02:46:35Z")

</div>

Hi, This is pt-osc options which I used.  
pt-online-schema-change --alter “XXX” D=XX,t=XX   
–no-drop-old-table   
–no-drop-new-table   
–chunk-size=1000   
–max-lag=10   
–recursion-method=processlist   
–defaults-file=XXX   
–socket=XXX   
–host=localhost   
–port=20306   
–user=user   
–password=XXX   
–progress=time,30   
–max-load=“Threads\_running=20”   
–critical-load=“Threads\_running=50”   
–tries create\_triggers:1:0.5   
–chunk-index=PRIMARY   
–charset=utf8mb4   
–set-vars=“lock\_wait\_timeout=1,innodb\_lock\_wait\_timeout=1,transaction\_isolation=‘repeatable-read’,binlog\_format=‘row’”   
–statistics   
–print   
–execute

When I use pt-osc with recursion-method=processlist, the host changed from localhost to XXX  
(This issue not occur with recursion-method=none)

With PTDEBUG=1, I found thant

# MasterSlave:4408 71730 Recursing from A=utf8mb4,D=XXX,F=XXX,S=XXX,h=localhost,p=…,t=XX,u=user to A=utf8mb4,F=XXX,S=XXX,h=10.X.X.X ,p=…,u=user

Can I know why this problem occur and solution for this?

---

<div class="post-metadata">

**Author:** ![B\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/b_a/32/13324_2.png) [@B\_A](https://forums.percona.com/u/B_A)\
**Post date:** [October 25, 2024, 2:59am UTC](https://forums.percona.com/t/pt-osc-change-host-value-from-localhost-to-ip/34584/2 "2024-10-25T02:59:31Z")

</div>

fyi) percona toolkit version is 3.5.7-1  
When I create user ‘user’@‘10.X.X.X’ and use recursion-method=processlist,  
the error message is

“Error while waiting for replica lag: Use of uninitialized value in string eq at /usr/bin/pt-online-schema-change line 4357.  
(in cleanup) Use of uninitialized value in string eq at /usr/bin/pt-online-schema-change line 4357.”

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 25, 2024, 12:17pm UTC](https://forums.percona.com/t/pt-osc-change-host-value-from-localhost-to-ip/34584/3 "2024-10-25T12:17:06Z")

</div>

There is no problem. pt-osc connects to localhost:20306 and runs 'SHOW PROCESSLIST" looking for binlog connections (ie: replicas). Whatever IP:PORT is in the processlist, that is what pt-osc will use. If this does not work for you, look at [the documentation](https://docs.percona.com/percona-toolkit/pt-online-schema-change.html) for using `--recursion-method=dsn`

---

<div class="post-metadata">

**Author:** ![B\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/b_a/32/13324_2.png) [@B\_A](https://forums.percona.com/u/B_A)\
**Post date:** [October 25, 2024, 12:46pm UTC](https://forums.percona.com/t/pt-osc-change-host-value-from-localhost-to-ip/34584/4 "2024-10-25T12:46:16Z")

</div>

If only ‘user’@‘localhost’ exist in MySQL, pt-osc can’t connect to MySQL server because it’s host changed from localhost to ip(e.g, 10.x.x.x)  
(Cannot connect to error occurs)

Did you mean this behavior is not problem?

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [October 25, 2024, 2:37pm UTC](https://forums.percona.com/t/pt-osc-change-host-value-from-localhost-to-ip/34584/5 "2024-10-25T14:37:05Z")

</div>

> [@B\_A](#):
>
> If only ‘user’@‘localhost’ exist in MySQL, pt-osc can’t connect to MySQL server because it’s host changed from localhost to ip(e.g, 10.x.x.x)  
> (Cannot connect to error occurs)

pt-osc discovered you have a replica at IP 10.x.x.x, pt-osc is trying to establish a direct connection to that host to monitor replication. The user ‘user’ needs to exist on the replica with an IP matching that of the server where you are running pt-osc.
