cancel
Showing results for 
Search instead for 
Did you mean: 

How can I tell what server is running in what console window under Linux?

0 Kudos
2,344

Hello,

I am running a HA system under Linux (Ubuntu 16.0.4). For testing I am running all three servers on the same host; in production this would be done with three hosts. I start a server w/-n MyServer1 and it starts but there is no mention of MyServer1 in the consol. After starting MyServer2 and MyServer3 I have three consoles open but no (quick) way to tell which server is in each. I have to look at the Port # at the start of the console output to infer which is which. (OK, I can see the Arbiter's output is different than the Primary and Mirror but it is those two consoles that I really need to be looking at!) How can I easily determine what is running in a console.

Thank you.

Accepted Solutions (0)

Answers (2)

Answers (2)

Thanks again to Vlad and Volker. Sorry for the delay in responding but my access to the forum broke for about a week!

Here is what works for me under Ubuntu 16.04:

gnome-terminal --window -e "bash -c \\"printf '\\e]0;TheConsoleTitle'; './LaunchAServer.sh' ${1} ${2}\\""

This creates a new console window with a title of “TheConsoleTitle” and then runs LaunchAServer.sh to get the server running with output to the console.

A complicating factor is that a –title option was removed from gnome-terminal in this version, hence the printf() hack to get a title onto the console.

Many thanks.

Vlad
Product and Topic Expert
Product and Topic Expert
0 Kudos

I appreciate your answer. Thanks.

Breck_Carter
Participant

MESSAGE statements apply to the server on which they are executed, they are not shipped to other servers.

You can open dbisql connections to the HA primary, HA secondary and Read-only Scale-Out copy databases, and execute MESSAGE TO CONSOLE statements on all three.

MESSAGE 'I am HA primary' TO CONSOLE;

I. 03/28 15:01:21. Starting database "demo" (C:\\HADEMO\\partner1\\demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:21. Database recovery in progress
I. 03/28 15:01:21.     Last checkpoint at Tue Mar 28 2017 15:00
I. 03/28 15:01:21.     Database "demo" transaction log offset after last checkpoint is 1302778
I. 03/28 15:01:21.     Transaction log: demo.log...
I. 03/28 15:01:21.     Database "demo" transaction log starts at offset 1298636
I. 03/28 15:01:21. Warning: Database "demo" mirroring:  partner, arbiter or state file configuration was not fully specified
I. 03/28 15:01:21. Database "demo" mirroring: local status for this server: role=unknown, state=synchronizing, sequence=1, yielding=N
I. 03/28 15:01:21. Database "demo" mirroring:  determining mirror role ...
I. 03/28 15:01:21. Database "demo" mirroring:  becoming primary server
I. 03/28 15:01:21. Database "demo" transaction log current offset is 1302778
I. 03/28 15:01:22.     Checkpointing...
I. 03/28 15:01:22. Starting checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:22. Finished checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:22. Recovery complete
I. 03/28 15:01:22. Database "demo" (demo.db) started at Tue Mar 28 2017 15:01
E. 03/28 15:01:29. Database "demo" mirroring:  mirror connection to server "partner2_demo" failed
I. 03/28 15:01:31. Database "demo" mirroring:  connected to arbiter "arbiter3_demo"
I. 03/28 15:01:31. Starting checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:31. Finished checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:35. Cache size adjusted to 13344K
I. 03/28 15:01:36. Database "demo" mirroring:  connected to partner "partner2_demo"
I. 03/28 15:01:38. Cache size adjusted to 13940K
I. 03/28 15:01:47. Starting checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:47. Finished checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:52. Database "demo" mirroring:  connected to child node "copy4_demo"
I. 03/28 15:04:25. I am HA primary

MESSAGE 'I am HA secondary' TO CONSOLE;

I. 03/28 15:01:35. Starting database "demo" (C:\\HADEMO\\partner2\\demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:35. Performance warning: Database file "C:\\HADEMO\\partner2\\demo.db" consists of 3 disk fragments
I. 03/28 15:01:35. Database recovery in progress
I. 03/28 15:01:35.     Last checkpoint at Tue Mar 28 2017 15:01
I. 03/28 15:01:35.     Database "demo" transaction log offset after last checkpoint is 1311878
I. 03/28 15:01:35.     Checkpoint log...
I. 03/28 15:01:36.     Transaction log: demo.log...
I. 03/28 15:01:36.     Database "demo" transaction log starts at offset 1298636
I. 03/28 15:01:36. Database "demo" mirroring: local status for this server: role=primary, state=synchronizing, sequence=1, yielding=N
I. 03/28 15:01:36. Database "demo" mirroring:  determining mirror role ...
I. 03/28 15:01:36. Database "demo" mirroring:  connected to partner "partner1_demo"
I. 03/28 15:01:36. Database "demo" mirroring: partner status for this server: role=mirror, state=synchronizing, sequence=2, yielding=N
I. 03/28 15:01:37. Database "demo" mirroring:  connected to arbiter "arbiter3_demo"
I. 03/28 15:01:37. Database "demo" mirroring: arbiter status for this server: role=mirror, state=synchronizing, sequence=2, yielding=N
I. 03/28 15:01:37. Database "demo" mirroring:  synchronizing ...
I. 03/28 15:01:37. Database "demo" transaction log current offset is 1311878
I. 03/28 15:01:37. Database "demo" (demo.db) started as mirror at Tue Mar 28 2017 15:01
I. 03/28 15:01:37. Database "demo" mirroring:  synchronized
I. 03/28 15:01:37. Database "demo" transaction log current offset is 1311890
I. 03/28 15:01:39. Cache size adjusted to 13380K
I. 03/28 15:01:47. Starting checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:47. Finished checkpoint of "demo" (demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:03:58. I am HA secondary

MESSAGE 'I am read-only scale-out copy' TO CONSOLE;

I. 03/28 15:01:52. Starting database "demo" (C:\\HADEMO\\copy4\\demo.db) at Tue Mar 28 2017 15:01
I. 03/28 15:01:52. Performance warning: Database file "C:\\HADEMO\\copy4\\demo.db" consists of 3 disk fragments
I. 03/28 15:01:52. Database recovery in progress
I. 03/28 15:01:52.     Last checkpoint at Tue Mar 28 2017 15:01
I. 03/28 15:01:52.     Database "demo" transaction log offset after last checkpoint is 1311924
I. 03/28 15:01:52.     Checkpoint log...
I. 03/28 15:01:52.     Transaction log: demo.log...
I. 03/28 15:01:52.     Database "demo" transaction log starts at offset 1298636
I. 03/28 15:01:52. Database "demo" mirroring:  determining mirror role ...
I. 03/28 15:01:52. Database "demo" mirroring:  connected to parent "primary_demo"
I. 03/28 15:01:52. Database "demo" mirroring:  synchronizing ...
I. 03/28 15:01:52. Database "demo" transaction log current offset is 1311924
I. 03/28 15:01:52. Database "demo" (demo.db) started as copy node at Tue Mar 28 2017 15:01
I. 03/28 15:01:52. Database "demo" mirroring:  parent reconnection process starting
I. 03/28 15:01:52. Database "demo" mirroring:  synchronizing ...
I. 03/28 15:01:53. Database "demo" mirroring:  synchronized
I. 03/28 15:01:53. Database "demo" transaction log current offset is 1311924
I. 03/28 15:01:53. Database "demo" mirroring:  parent reconnection process stopping
I. 03/28 15:02:05. Cache size adjusted to 13208K
I. 03/28 15:02:11. Cache size adjusted to 13704K
I. 03/28 15:02:21. Cache size adjusted to 13876K
I. 03/28 15:02:27. Cache size adjusted to 14260K
I. 03/28 15:02:32. Cache size adjusted to 14356K
I. 03/28 15:02:53. I am read-only scale-out copy
jack_schueler
Product and Topic Expert
Product and Topic Expert

Hey, that was my idea. Shouldn't have let Volker talk me out of it. 🙂

VolkerBarth
Contributor
0 Kudos

Volker just was in doubt and asked for a clarification - and now has a proof. Thanks to both of you:)

0 Kudos

Thanks to JB, Volker and Breck for the various suggestions. The MESSAGE approach does work but then I still have to search the console (Ubuntu Terminal) for the string so that's really not different than searching the console for the PORT # that I know I started the server on. I've been hoping someone can tell me how to get a "Server ID" onto the title of the Terminal/console window so I can just look at the three windows and instantly see which is which. I expected that HA systems mostly ran under Linux and expected that this was a common problem with an easy answer. I think I'll probably have to submit this question to an Ubuntu forum to see how to do this.

Thanks again to everyone.

Vlad
Product and Topic Expert
Product and Topic Expert

O-o-o! Changing the title of the terminal window/tab. Well, I think to answer this question you'd better google for the answer. E.g. this is what I found: http://unix.stackexchange.com/questions/177572/how-to-rename-terminal-tab-title-in-gnome-terminal

And I am still thinking that you should simply tell us what you want to do with everything we gave you. Do you want to have an alerting system if something happens? Or you want to consolidate/process logs and display them (react if again something happens), or you have some kind of dashboard and you want to know how your landscape is working.

Please tell us, give screenshots, photos, maybe record videos and audios 🙂

VolkerBarth
Contributor

I expected that HA systems mostly ran under Linux and expected that this was a common problem with an easy answer.

Hm, I do expect that real HA systems do not run three database servers on the same machine, which seems to be the current problem you face when trying to distinguish those console output...

FWIW, when doing a HA demo on Windows (not that uncommon, either, cf. the tutorials in the SA17 docs), you usually have a fitting window for each database engine, named accordingly with the server name (dbsrv17 -n), so that may be a particular Linux issue...