Repmgr : It automatically promotes to new master but other standby stopped

I’m trying to setup postgre with repmgr and here is the rsult

enter image description here

The scenario is,

  1. i tried to spinup 1 primary and 2 standby.
  2. then i stop the primary so the postgres-2 got promoted.
  3. Unfortunately the postgres-3 got disconnected due to some reason but here is the error log enter image description here

It looks like it was able to connect but the postgres restared and didn’t come back. 4. I spin up another standby but the master it was pointing is the old one which is postgres-1 That might be the reason why it is saying !running and still primary even if the actual primary is postgres-2.

My question is how can i make other standby not disconnected every time i promoted (automatically due to failure etc.) a new primary?

here is my repmgr.conf

NET_IF=`netstat -rn | awk '/^0.0.0.0/ {thif=substr($  0,74,10); print thif;} /^default.*UG/ {thif=substr($  0,65,10); print thif;}'` NET_IP=`ifconfig $  {NET_IF} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`   HOSTNAME='postgres-'$  {my_node}  cat<<EOF > /etc/repmgr.conf     node_id=$  {my_node}     node_name=$  HOSTNAME     conninfo='host=$  {NET_IP} user=repmgr password=repmgr dbname=repmgr connect_timeout=2'     data_directory='$  {PGDATA}'      log_level=INFO     log_facility=STDERR     log_status_interval=300          pg_bindir='/usr/lib/postgresql/10/bin'     use_replication_slots=1          failover=automatic     promote_command='repmgr standby promote'     follow_command='repmgr standby follow -W' EOF 

Also, I’m running using docker extending the official postgres docker image

FROM postgres:10  RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ stretch-pgdg main 10" \           >> /etc/apt/sources.list.d/pgdg.list  # RUN ln -s /home/postgres/repmgr.conf /etc/repmgr.conf  RUN apt-get update && apt-get install wget -y RUN apt-get install net-tools -y RUN apt-get update; apt-get install -y git make postgresql-server-dev-10 libpq-dev postgresql-10-repmgr repmgr-common  #RUN wget -c https://repmgr.org/download/repmgr-5.1.tar.gz -O - | tar -xz  RUN touch /etc/repmgr.conf; \     chown postgres:postgres /etc/repmgr.conf  ENV PRIMARY_NAME=localhost ENV REPMGR_USER=repmgr ENV REPMGR_DB=repmgr ENV REPMGR_PASSWORD=repmgr  COPY postgresql.replication.conf /tmp/postgresql.replication.conf  COPY scripts/*.sh /docker-entrypoint-initdb.d/ 

Lastly, here is how i check if should be register as primary or standby

PGHOST=$  {PRIMARY_NAME}  installed=$  (psql -qAt -h $  {PGHOST} repmgr -c "SELECT 1 FROM pg_tables WHERE tablename='nodes'")  if [ "$  {installed}" != "1" ]; then     echo "Registering as PRIMARY SERVER"     repmgr primary register else     my_node=$  (grep node_id /etc/repmgr.conf | cut -d= -f 2)     is_reg=$  (psql -qAt -h $  {PGHOST} repmgr -c "SELECT 1 FROM repmgr.nodes WHERE node_id=$  {my_node}")      if [ "$  {is_reg}" != "1" ] && [ $  {my_node} -gt 1 ]; then         echo "Registering as STANDBY SERVER"          pg_ctl -D $  {PGDATA} stop -m fast         rm -Rf $  {PGDATA}/*         repmgr -h $  {PRIMARY_NAME} -d repmgr standby clone --fast-checkpoint         pg_ctl -D $  {PGDATA} start &         sleep 1         repmgr -h $  {PRIMARY_NAME} -d repmgr standby register         fi fi 

here is my update for the postgres.conf

 sed -i "s/#*\(shared_preload_libraries\).*/='repmgr'/;" $  {PGDATA}/postgresql.conf sed -i "s/#port = 5432/port = 5432/g" $  {PGDATA}/postgresql.conf sed -i "s/#max_wal_senders/max_wal_senders/g"  $  {PGDATA}/postgresql.conf sed -i "s/#wal_level/wal_level/g"  $  {PGDATA}/postgresql.conf sed -i "s/#max_replication_slots/max_replication_slots/g"  $  {PGDATA}/postgresql.conf sed -i "s/#hot_standby/hot_standby/g"  $  {PGDATA}/postgresql.conf  sed -i "s/#archive_mode = off/archive_mode = on/g"  $  {PGDATA}/postgresql.conf  echo "archive_command = '/bin/true'" >>  $  {PGDATA}/postgresql.conf 

I’m using postgres:10 and repmgr-5.0

hope someone could help me on this. Thanks,

gnome system-monitor status bar app disappears after standby

On 18.04. When I boot up and log in, the gnome system-monitor shows up in my status bar exactly like it should, but as soon as the system goes into stand-by and then I wake it up, system-monitor is gone and doesn’t return until I reboot.

this thing

Is there a way I can get this to not happen, or is there an alternative tray app that provides the same functionality but works better? Thanks!

How to set monitor on standby after certain period


Machine: Dell Vostro PC, System: Ubuntu 18.04, Desktop: Gnome 3.28 running Wayland.

Is there a command in Terminal I can make so that my monitor goes into standby after a fixed period of idle time?

I know with the GUI I can set the idle time for up to 15 mins through the Settings–>Power selection. But supposing I want to set this period longer, eg 20 mins. I’ve looked at xrand and xset options, but neither seem to give any examples of actually doing this, and I would have expected it to be a common query, but no-one appears to have raised it.

Also is there a way of this setting being indefinite rather than just for a session?

Two Databases in Standby/ Read-Only, Can Only Alter to SINGLE_USER One of Them

I am setting up Transaction Log shipping in Standby/ Read-Only mode of two databases to multiple instances.

One if the databases has no issue when I:

ALTER DATABASE [dbname] SET SINGLE USER WITH ROLLBACK IMMEDIATE; ALTER DATABASE [dbname] SET MULTI_USER; 

the other one throws an error:

Failed to update database "other_dbname" because the database is read-only. 

I cannot see any difference between the two. I’ve checked properties and all of the options are the same. From the options tab, the database that would throw the error had the Compatibility level set to SQL Server 2012 and one that would allow me to ALTER had that value set to SQL Server 2014, but changing them both to 2014 did not resolve the issue.

I’m at a complete loss as to what the issue could be or what I could look into that would point me in the correct direction.

Do domestic ferry companies in Japan sell “standby” tickets when passengers cancel very late or don’t show up for their reservations?

I’m in Hokkaido, Japan and it’s Golden Week so many things are booked out, including longer distance ferries.

Japanese ferry websites have always been quite bad. No English version, text as images in Japanese version so no Google Translate, etc. No English speaking staff at the terminal is also usual.

I’d like to take a ferry from Hokkaido to Honshu tomorrow. My first choice seems to be booked full for the cheaper berths.

What I’m wondering is if I get to the ferry terminal at boarding time is there a chance they sell “standby” tickets for no-shows?

Is this unheard of in Japan? Pretty normal? Or some do and some don’t?

Sticky keys: Shift starts in “locked” mode after stand-by

I have sticky keys enabled following an injury that prevents me from typing with my left hand.

I have some strange behaviour with the Shift key when coming out of stand-by and suspend.

When I awake my laptop from sleep (by opening the lid) my Shift key starts in a “locked” state (as if it were pressed twice in a row). When I awake it from “suspend” (after using the “Suspend” option in Unity’s gear menu), the Shift key comes up as pressed once.

I’m on Ubuntu 18.04 with Unity 7.5.0 as my desktop. I have indicator-xkbmod from ppa:nilarimogard/webupd8 installed to tell me the state of the keys.

What can I do so the Shift key doesn’t get locked when I wake up my laptop? It can be really annoying if I forget it does this (which is all the time).

how to stop Windows Server 2016 from standby mode?

My Windows Server 2016 enters in standby mode without following any regular pattern and I need it “awake” 24/7 because I connect to it through remote connection. Therefore, when this happens, I can’t use the remote connection and when I physically see the server, the power button is orange and blinking.

I’ve tried:

powercfg.exe /hibernate off 

but still, at random times, this happens. Any idea on how to solve this?

How to standby a monitor using xset in multi monitor setup

While having two or more monitor working together, Is there any way to put a single one of them on standby/suspend by issuing a command like: xset dpms force suspend? or having a time set for that purpose like: xset dpms 100 0 0 which works on these monitors separately?

I’ve got two monitor working along each other, eDP1 (My Laptop) and VGA1 (An External monitor).

I want each of them to go into suspend/standby mode separately if I’m not directly interacting with them, suppose I’m watching a movie on VGA1, and for an hour and half eDP1 is on doing nothing.

I’m not interested in using xrandor --off --output eDP1 because it’s not fast enough to work with.

I want my monitor to be ready to work, with a simple mouse movement so I’m able to switch between them fast.

  • Running Ubuntu 18.04
  • Window Manager: OpenBox

hdparm -C states the drive is in standby regardless if the drive is in standby or not

I have a strange issue. I have a WD Green 3TB drive that always reports its in standby. The drive will go to sleep on it’s own after 30 minutes (regardless of what I set with hdparm. But if I do -C while its sleeping or while Im actively using it, it always reports “standby”.

It is also unresponsive to:

sudo hdparm -y /dev/sda 

Does it not support -C or -y features? If so, is there any other way for me to reduce the standby time from 30min to 15min? And/or be able to check if its in standby or not remotely (ssh) ?

Here is more info about the drive:

sudo hdparm -I /dev/sda  /dev/sda:  ATA device, with non-removable media         Model Number:       WDC WD30EZRX-00D8PB0         Firmware Revision:  80.00A80         Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6, SATA Rev 3.0 Standards:         Supported: 9 8 7 6 5         Likely used: 9 Configuration:         Logical         max     current         cylinders       16383   16383         heads           16      16         sectors/track   63      63         --         CHS current addressable sectors:    16514064         LBA    user addressable sectors:   268435455         LBA48  user addressable sectors:  5860533168         Logical  Sector size:                   512 bytes         Physical Sector size:                  4096 bytes         device size with M = 1024*1024:     2861588 MBytes         device size with M = 1000*1000:     3000592 MBytes (3000 GB)         cache/buffer size  = unknown Capabilities:         LBA, IORDY(can be disabled)         Queue depth: 32         Standby timer values: spec'd by Standard, with device specific minimum         R/W multiple sector transfer: Max = 16  Current = 0         DMA: *mdma0 mdma1 mdma2 udma0 udma1 udma2 udma3 udma4 udma5 udma6              Cycle time: min=120ns recommended=120ns         PIO: pio0 pio1 pio2 pio3 pio4              Cycle time: no flow control=120ns  IORDY flow control=120ns Commands/features:         Enabled Supported:            *    SMART feature set                 Security Mode feature set            *    Power Management feature set            *    Write cache            *    Look-ahead            *    Host Protected Area feature set            *    WRITE_BUFFER command            *    READ_BUFFER command            *    NOP cmd            *    DOWNLOAD_MICROCODE                 Power-Up In Standby feature set            *    SET_FEATURES required to spinup after power up                 SET_MAX security extension            *    48-bit Address feature set            *    Device Configuration Overlay feature set            *    Mandatory FLUSH_CACHE            *    FLUSH_CACHE_EXT            *    SMART error logging            *    SMART self-test            *    General Purpose Logging feature set            *    64-bit World wide name            *    WRITE_UNCORRECTABLE_EXT command            *    {READ,WRITE}_DMA_EXT_GPL commands            *    Segmented DOWNLOAD_MICROCODE            *    Gen1 signaling speed (1.5Gb/s)            *    Gen2 signaling speed (3.0Gb/s)            *    Gen3 signaling speed (6.0Gb/s)            *    Native Command Queueing (NCQ)            *    Host-initiated interface power management            *    Phy event counters            *    NCQ priority information            *    READ_LOG_DMA_EXT equivalent to READ_LOG_EXT                 DMA Setup Auto-Activate optimization                 Device-initiated interface power management            *    Software settings preservation            *    SMART Command Transport (SCT) feature set            *    SCT Write Same (AC2)            *    SCT Features Control (AC4)            *    SCT Data Tables (AC5)                 unknown 206[12] (vendor specific)                 unknown 206[13] (vendor specific)                 unknown 206[14] (vendor specific) Security:         Master password revision code = 65534                 supported         not     enabled         not     locked         not     frozen         not     expired: security count                 supported: enhanced erase         430min for SECURITY ERASE UNIT. 430min for ENHANCED SECURITY ERASE UNIT. Logical Unit WWN Device Identifier: 50014ee058f13d3c         NAA             : 5         IEEE OUI        : 0014ee         Unique ID       : 058f13d3c Checksum: correct 

It does spit at me an error when I try to use -C or -y, but I am not sure what this long hex string means. And from what I understand it has to be able to read the drive to get that “drive state is: standby”, otherwise it wouldnt print that?

sudo hdparm -C /dev/sda  /dev/sda: SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  drive state is:  standby  sudo hdparm -y /dev/sda  /dev/sda:  issuing standby command SG_IO: bad/missing sense data, sb[]:  70 00 05 00 00 00 00 0a 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00