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.

asked 25 Mar, 18:27

AlK's gravatar image

AlK
3101523
accept rate: 50%

Comment Text Removed
1

I don't understand the question, but I think you can give meaningful names to your servers (e.g. server1, server2 etc). Server1 can be started from the console #1, Server2 - from console #2.

You can also use the SQL statement (if you have connected to the HA environment, but you want to know where you are exactly) to determine the server name:

SELECT PROPERTY ('ServerName'); // http://dcx.sap.com/index.html#sqla170/en/html/3bc6ad206c5f1014b043b4cc42d7fc07.html

This is everything I know :(

(27 Mar, 09:25) Vlad

Hi Vlad,

Thanks for the reply. The problem is that when I start multiple servers for HA on the same host (test only, we would use different servers in production) each server is launched in a Linux console that is simply titled "Terminal". So now I have three console windows open with no easy way to determine which is showing the console out put for which server. So, when I'm trying to see what's happening on "Server 01" I have rough time finding its console. The server doesn't put out it's own name at the top of the text being dumped into the console so it's a problem. Any way to force the server name in the text being displayed in the console? Any other ideas?

(27 Mar, 13:17) AlK
Replies hidden
1

Hm, instead of the console, you can use -o option (http://dcx.sap.com/index.html#sqla170/en/html/3bc8723c6c5f10149da5dc2f3b74259d.html) to log messages into the file. In this case, the server can be started as a service and everything you need is to use Linux "tail" utility to read logs in real-time.

The better thing (in my ideal world), I'd aggregate logs with Logstash/Elastic Stack/Splunk and do something with them.

To monitor SA, you can use... well, it depends on what you want to do with this info :)

(28 Mar, 04:11) Vlad
1

Some thoughts.

Perhaps you could set the terminal window title before starting the server to contain the server name.

You could look for a recent Checkpoint message in the console log (it has the database name).

As a last resort, you could send text to the console (MESSAGE 'identifying text' TO CONSOLE).

(28 Mar, 10:17) JBSchueler
Replies hidden

As for the last 2 suggestions, would those work in a HA setup? I'd expect that this would be tied to the primary server's output...

(28 Mar, 14:35) Volker Barth

Good point. Probably not.

(28 Mar, 14:48) JBSchueler

> Probably not

Thank you for playing... :)

(28 Mar, 15:11) Breck Carter
showing 3 of 7 show all flat view

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
permanent link

answered 28 Mar, 15:09

Breck%20Carter's gravatar image

Breck Carter
25.8k428592853
accept rate: 20%

2

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

(28 Mar, 15:37) JBSchueler
Replies hidden

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

(29 Mar, 01:56) Volker Barth

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.

(29 Mar, 11:13) AlK
2

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 :)

(30 Mar, 02:13) Vlad
2

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...

(30 Mar, 03:12) Volker Barth

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.

permanent link

answered 05 Apr, 16:23

AlK's gravatar image

AlK
3101523
accept rate: 50%

I appreciate your answer. Thanks.

(06 Apr, 01:59) Vlad
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×61
×54

question asked: 25 Mar, 18:27

question was seen: 211 times

last updated: 06 Apr, 01:59