Monday, July 29, 2024

Add JMX monitor without authen and SSL

Add this line to java command, replace 10.68.55.37 with ip of local jmx server 

 -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=10.68.55.37 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false

 


Saturday, August 12, 2023

Install kernel mainline

 

  • In Terminal, enter uname -mrs to determine the current kernel version.
  • Check and get any needed updates by entering sudo apt update && sudo apt upgrade.
  • Add the ppa for the kernels: sudo add-apt-repository ppa:cappelikan/ppa -y
  • Again, get the update list, now that the new repository has been added: sudo apt update
  • Install the latest mainline kernel: sudo apt install mainline -y
  • Reboot.

Dell 9310 fix suspend issue

 


BIOS, turn off Early Logo Display to OFF in the Sign of Life options

BIOS, disable Secure Boot

In the system, edit and configure in /etc/default/grub to add to the kernel options : mem_sleep_default=deep

My current kernel options are : GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mitigations=off mem_sleep_default=deep"

(do NOT use mitigations=off unless you seriously know what you're doing)

Reboot. TO check if the deep sleep is on :

cat /sys/power/mem_sleep

Should return :

s2idle [deep]

The deep here confirms the deep sleep mode is turned on.

Saturday, June 10, 2023

Renew openvpn certificate

 cd /etc/openvpn/easy-rsa
#replace server_X79s9v1gWRTvLcGp with your server_yourcertificate
# name server_X79s9v1gWRTvLcGp can be found in /etc/openvpn
./easyrsa renew server_X79s9v1gWRTvLcGp nopass
cp pki/issued/server_X79s9v1gWRTvLcGp.crt  ../
cp pki/private/server_X79s9v1gWRTvLcGp.key ../
/etc/init.d/openvpn restart

 

Friday, April 21, 2023

Run DBeaver portable with jdk 17

 add to eclipse.ini config:


-XX:+IgnoreUnrecognizedVMOptions
--add-modules=ALL-SYSTEM
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/java.net=ALL-UNNAMED

Thursday, March 23, 2023

Setup relicate table Postgres

 

SHOW wal_level;

ALTER SYSTEM SET wal_level = logical;


On Publisher database:

--STEP 1: create publiccation named mypub, for table1,table2, table3
CREATE PUBLICATION mypub FOR TABLE newtable;

--check created publication
SELECT *
FROM pg_catalog.pg_publication

SELECT *
FROM pg_catalog.pg_publication_tables

--STEP 2: for each subscription, need to creating relication slot on publication node, 'pgoutput' is plugin
SELECT pg_create_logical_replication_slot('mysub', 'pgoutput');

--check replication slot
SELECT slot_name, slot_type, active FROM pg_replication_slots;

--in case to manual delete replication slot, run
SELECT * FROM pg_drop_replication_slot('slot_name');

 
On Subscriber database
 
--create subscription
CREATE SUBSCRIPTION mysub
CONNECTION 'host=192.168.56.20 port=5432 user=databaseuser password=passhere dbname=dbtest1'
PUBLICATION mypub
WITH (create_slot=false);

--check all subscription
SELECT *
FROM pg_subscription

-- drop subscription
ALTER SUBSCRIPTION mysub DISABLE;
ALTER SUBSCRIPTION mysub SET (slot_name=NONE);
DROP SUBSCRIPTION mysub

Friday, March 17, 2023

Fix Sequence Postgres

 SELECT
    'SELECT SETVAL(' ||
       quote_literal(quote_ident(sequence_namespace.nspname) || '.' || quote_ident(class_sequence.relname)) ||
       ', COALESCE(MAX(' ||quote_ident(pg_attribute.attname)|| '), 1) ) FROM ' ||
       quote_ident(table_namespace.nspname)|| '.'||quote_ident(class_table.relname)|| ';'
FROM pg_depend
    INNER JOIN pg_class AS class_sequence
        ON class_sequence.oid = pg_depend.objid
            AND class_sequence.relkind = 'S'
    INNER JOIN pg_class AS class_table
        ON class_table.oid = pg_depend.refobjid
    INNER JOIN pg_attribute
        ON pg_attribute.attrelid = class_table.oid
            AND pg_depend.refobjsubid = pg_attribute.attnum
    INNER JOIN pg_namespace as table_namespace
        ON table_namespace.oid = class_table.relnamespace
    INNER JOIN pg_namespace AS sequence_namespace
        ON sequence_namespace.oid = class_sequence.relnamespace
ORDER BY sequence_namespace.nspname, class_sequence.relname;

 

 

Ref: https://wiki.postgresql.org/wiki/Fixing_Sequences