Is it possible to select network interface(eth0, eth1, ens192 etc.) in minikube none driver? - minikube

I have two network interfaces on my computer. Their names are eth0 and eth1.
+--------------------------------------------------+
| My Computer |
| |
| eth0 eth1 |
| + + |
+--------------------------------------------------+
| |
| |
| |
| |
v v
10.10.22.50 192.168.29.50
(minikube selects it automatically) (I want you to select this)
eth0 network interface is selected automatically when I start minikube with the following command: (I prefer none driver for some special reasons.)
$ sudo -E minikube start \
--driver=none \
--kubernetes-version=1.24.3 \
--container-runtime=docker \
$ minikube ip
10.10.22.50
I want to select eth1 network interface(192.168.29.50). Is this possible?
My Environment
OS: Ubuntu 22.04 LTS
minikube version: v1.27.1
docker version: 20.10.18

Related

Postgres Register Standby fails

I am trying to setup a Primary and a standby using repmgr. I think I have successfully setup master, but standby setup keeps failing.
On Standby node
/usr/pgsql-12/bin/repmgr -h master_ip standby clone
NOTICE: destination directory "/var/lib/pgsql/12/data" provided
INFO: connecting to source node
DETAIL: connection string is: host=master_ip
DETAIL: current installation size is 32 MB
ERROR: repmgr extension is available but not installed in database "(null)"
HINT: check that you are cloning from the database where "repmgr" is installed
On Master Node:
/usr/pgsql-12/bin/repmgr cluster show
ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string
----+-------------+---------+-----------+----------+----------+----------+----------+----------------------------------------------------------------
1 | hostname | primary | * running | | default | 100 | 1 | host=master_ip dbname=repmgr user=repmgr connect_timeout=2
postgres=# SELECT * FROM pg_available_extensions WHERE name='repmgr';
name | default_version | installed_version | comment
--------+-----------------+-------------------+------------------------------------
repmgr | 5.3 | | Replication manager for PostgreSQL
resolved after adding -U repmgr -d repmgr to the clone command.

pgpool/postgres - replication_delay is too high, how to reset?

in our setup the show pool_nodes shows a very high replication_delay and it keeps increasing, becuase of which any new queries are not replicated in the slave
following is the output of show pool_nodes command, is there a way to reset this, data loss if fine as this is not a live/production system.
[root#DB2 ~]# psql -h DB-HA-Hostname -U postgres -p 5432 -c 'show pool_nodes'
node_id | hostname | port | status | lb_weight | role | select_cnt | load_balance_node | replication_delay | last_status_change
---------+--------------------------------------+------+--------+-----------+---------+------------+-------------------+-------------------+---------------------
0 | DB1-hostname | 5432 | up | 0.500000 | primary | 0 | true | 0 | 2021-01-11 19:32:00
1 | DB2-hostname | 5432 | up | 0.500000 | standby | 0 | false | 54986528 | 2021-01-11 19:32:00
(2 rows)
I have tried, restarting nodes, restarting pgpool, restarting postgresql , deleting database etc.. but no luck. As soon as the slave gets attached the replication_delay is high again..
You can run this command to check status of replication:
psql -h DB-HA-Hostname -U postgres -p 5432 -c "select * from pg_stat_replication" -x
if it shows:
if not, the configuration has failed.
You can show your configuration ?
Check the replication is running or not if it's not running re-configure the standby then attached the nodes
select * from pg_stat_replication;
after taking basebackup start the postgresql server then pcp-attach-node on pgpool

repmgr - how to make previous Primary to become a standby after failover

After performing a fail over, I had the previous Primary down, and the old standby became the Primary, as expected.
$ repmgr -f /etc/repmgr.conf cluster show --compact
ID | Name | Role | Status | Upstream | Location | Prio. | TLI
----+-----------------+---------+-----------+----------+----------+-------+-----
1 | server1 | primary | - failed | | default | 100 | ?
2 | server2 | primary | * running | | default | 100 | 2
3 | PG-Node-Witness | witness | * running | server2 | default | 0 | 1
I would like to make the old Primary join the cluster as a standby.
I gather the rejoin command should do that.
However, when I try to rejoin it, to be the new standby, I get this (I run this on the old Primary which is down ):
repmgr -f /etc/repmgr.conf -d 'host=10.9.7.97 user=repmgr dbname=repmgr' node rejoin
--where 10.9.7.97 is the ip of node I am running from.
I get this error:
$ repmgr -f /etc/repmgr.conf -d 'host=10.97.7.97 user=repmgr dbname=repmgr' node rejoin --verbose -
NOTICE: using provided configuration file "/etc/repmgr.conf"
ERROR: connection to database failed
DETAIL:
could not connect to server: Connection refused
Is the server running on host "10.97.7.97" and accepting
TCP/IP connections on port 5432?
Of course postgres is down on 10.9.7.97 - the old primary.
If I start it however, it starts as another primary:
$ repmgr -f /etc/repmgr.conf cluster show --compact
ID | Name | Role | Status | Upstream | Location | Prio. | TLI
----+-----------------+---------+-----------+----------+----------+-------+-----
1 | server1 | primary | ! running | | default | 100 | 1
2 | server2 | primary | * running | | default | 100 | 2
3 | PG-Node-Witness | witness | * running | server2 | default | 0 | 1
so what is the way to make the old primary the new standby...?
Thanks
Apparently the
-d 'host=
in the rejoin command, should specify the current Primary (previous standby).

postgres -c <parameter>=<value> not working for Postgres 11 in docker

I'm running a Postgres inside a docker container. I want to change the default config of Postgres so I'm running:
docker container run -d postgres -c max_connections=200 -c shared_buffers=1GB -c effective_cache_size=3GB -c maintenance_work_mem=256MB -c checkpoint_completion_target=0.7 -c wal_buffers=16MB
But when I'm connecting to Postgres running:
docker exec -it container_name psql
And then the result of :
SHOW max_connections;
is
max_connections
-----------------
100
(1 row)
And it's not just max_connections. None of the parameters are changed. And I don't know what is the problem with what I'm doing?
Update: the result of
root=# SELECT *
root-# FROM pg_settings
root-# WHERE name = 'max_connections';
is
name | setting | unit | category | short_desc | extra_desc | context | vartype | source | min_val | max_val | enumvals | boot_val | reset_val | sourcefile | sourceline | pending_restart
-----------------+---------+------+------------------------------------------------------+----------------------------------------------------+------------+------------+---------+--------------------+---------+---------+----------+----------+-----------+------------------------------------------+------------+-----------------
max_connections | 100 | | Connections and Authentication / Connection Settings | Sets the maximum number of concurrent connections. | | postmaster | integer | configuration file | 1 | 262143 | | 100 | 100 | /var/lib/postgresql/data/postgresql.conf | 64 | f
(1 row)
If you cannot get it to work while starting the server, try ALTER SYSTEM:
psql -c "ALTER SYSTEM SET max_connections=200; SELECT pg_reload_conf()"
That changes the setting in postgresql.auto.conf.
Changing shared_buffers, wal_buffersandmax_connections` require a restart of the PostgreSQL server, the other parameters can be changed on the fly.
Is it possible that you are connecting to the wrong container? When I try to run psql as you have, I get:
$ docker exec -it boring_hermann psql
psql: FATAL: role "root" does not exist
...because the standard user is root and has no access to the container's DB. When I run as user 999, group 999 (the one listed as postgres in that image), it works correctly:
$ docker exec -u 999:999 -it boring_hermann psql
psql (11.1 (Debian 11.1-1.pgdg90+1))
Type "help" for help.
postgres=# show max_connections;
max_connections
-----------------
200
(1 row)

Set binlog for Mysql 5.6 & Ubuntu16.4

in /etc/mysql/my.cnf:
[mysqld]
log_bin=mysql-bin
binlog_format=ROW
server-id=11
then on mysql client:
mysql> show variables like '%binlog%';
+-----------------------------------------+----------------------+
| Variable_name | Value |
+-----------------------------------------+----------------------+
| binlog_cache_size | 32768 |
| binlog_checksum | CRC32 |
| binlog_direct_non_transactional_updates | OFF |
| binlog_format | STATEMENT |
| binlog_max_flush_queue_time | 0 |
| binlog_order_commits | ON |
| binlog_row_image | FULL |
| binlog_rows_query_log_events | OFF |
| binlog_stmt_cache_size | 32768 |
| innodb_api_enable_binlog | OFF |
| innodb_locks_unsafe_for_binlog | OFF |
| max_binlog_cache_size | 18446744073709547520 |
| max_binlog_size | 1073741824 |
| max_binlog_stmt_cache_size | 18446744073709547520 |
| sync_binlog | 0 |
+-----------------------------------------+----------------------+
15 rows in set (0.00 sec)
I have googled "my.cnf dont take effect" and got "Changes to my.cnf don't take effect (Ubuntu 16.04, mysql 5.6)"
Changes to my.cnf don't take effect (Ubuntu 16.04, mysql 5.6)
I have tested the two answers. But when I start mysql with sudo service mysql start, there always be this error:
/etc/init.d/mysql[27197]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
/etc/init.d/mysql[27197]: [61B blob data]
/etc/init.d/mysql[27197]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
/etc/init.d/mysql[27197]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
/etc/init.d/mysql[27197]:
mysql[26527]: ...fail!
systemd[1]: mysql.service: Control process exited, code=exited status=1
systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
I have spent two days searching answers, and still not find nothing helpful. Could any one please help me out? Thank you!
Reinstall MySQL
Clean MySQL according to :
https://askubuntu.com/questions/172514/how-do-i-uninstall-mysql
sudo apt-get purge mysql-server mysql-client mysql-common mysql-server-core-* mysql-client-core-*
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get autoremove
sudo apt-get autoclean
as well as https://www.jianshu.com/p/c76b31df5d09
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
Install by sudo apt-get install mysql-server-5.6
Make changes in my.cnf take effect
Second answer by Keeth(user:20588) on
Changes to my.cnf don't take effect (Ubuntu 16.04, mysql 5.6)
Configure binlog by editing /etc/mysql/my.cnf
[mysqld]
log_bin=mysql-bin
binlog_format=ROW
server-id=11