Posts

Showing posts from 2019

MySQL backup tips

From https://hackernoon.com/elephant-in-the-room-database-backup-574da50e6d88 For instance, mysqldump will take dumps conforming to the client’s character set, and your favorite emojis such as 🍣 and 🍺 in utf8mb4 could be corrupt and replaced by  ? in the backup. If you have never checked, do it right now. Just set --default-character-set=binary option — you’re welcome. Or if you missed the --single-transaction option, you are likely to have inconsistent backups (e.g. item changed hands but money didn’t transfer) that are never easy to spot even if you regularly test the recovery procedure manually.

Postgresql tips and links

Free training material (documentation) in French: https://public.dalibo.com/exports/formation/manuels/formations/ Free book: https://books.goalkicker.com/PostgreSQLBook Documentation about the internals of PostgreSQL:  The internals of PostgreSQL  Configuration wizards https://pgconfigurator.cybertec-postgresql.com/ https://pgtune.leopard.in.ua/ https://postgresqlco.nf / is a bit different, but can help https://pgmetrics.io/   Not a wizard, but provides many info about PG instance  Troubleshooting Observability: what function gives information about which component/process? https://pgstats.dev/     https://postgresqlco.nf/  You can upload your configuration, get recommendations, etc  Clients psql: PostgreSQL-provided client (command-line) pgcli CLI client with auto-completion and syntax highlighting   https://www.pgcli.com/ "Full" list Toad for PostgreSQL Kangaroo https://dbkangaroo.github.io/ Backups barman https://sourceforge.net/projects/pgbarman/files/2

Comware shortcuts

interface GigabitEthernet 1/0/1 => interface g1/0/1 interface Ten-GigabitEthernet 1/0/25 => interface te1/0/25 Hotkeys: <comware-switch>display hotkey ----------------- HOTKEY -----------------             =Defined hotkeys= Hotkeys Command CTRL_G  display current-configuration CTRL_L  display ip routing-table CTRL_O  undo debugging all            =Undefined hotkeys= Hotkeys Command CTRL_T  NULL CTRL_U  NULL             =System hotkeys= Hotkeys Function CTRL_A  Move the cursor to the beginning of the current line. CTRL_B  Move the cursor one character left. CTRL_C  Stop current command function. CTRL_D  Erase current character. CTRL_E  Move the cursor to the end of the current line. CTRL_F  Move the cursor one character right. CTRL_H  Erase the character left of the cursor. CTRL_K  Kill outgoing connection. CTRL_N  Display the next command from the history buffer. CTRL_P  Display the previous command from the history buffer. CTRL_R  Redisplay the current line. CTRL_V 

VIM substitutions

Substitution of a text by another text within a single line (replace I by We): :s/I/We/g Case-insensitive: :s/I/We/gi Substitute helo for hello in the next 4 lines: :s/helo/hello/g 4

VMWare vSphere 6.0 web client via SSH tunnel

Hi, I just found a way to connect to a remote vCenter server via SSH tunnel, using the web client.  This has been tested on vSphere 6.0, it may need some modifications to work on other version. Let's define some information for this example: 192.168.x.x will be the IP address of the vSphere web client (vCenter) x.x.x.x will be the IP address of the SSH server localuser is the name of the user on the local machine (from which you execute the SSH command) remoteuser is the name of the username on the (remote) SSH server 5252 is the port on which the (remote) SSH server is listening The first thing to do is to execute this shell command to open an SSH connection and create tunnels: sudo ssh -i /home/localuser/.ssh/id_rsa -l remoteuser1 -L 443:192.168.x.x:443 -L 902:192.168.x.x:902 -L 903:192.168.x.x:903 -L 9443:192.168.x.x:9443 -p 5252 x.x.x.x Please not that we must use sudo because we're using ports =< 1024. Also note the -i , specifying  the path to my pri

Dealing with an old Rancid installation

Your new device is not supported by your current rancid install?  There is usually a solution. Get the *rancid.in and *login.in files from the github repo (https://github.com/earendilfr/rancid/tree/master/bin) Put them in the bin directory of your rancid install, rename them to remove the .in at the end chown rancid.rancid and chmod +x to these files Make sure you make the mapping in bin/rancid-fe so that the vendor is known and rancid knows which rancid script use for this vendor Edit the *rancid file to set the perl path at the top Edit the *login file to set the expect path at the top Configure your .clogin for your device Add your device to router.db Test with rancid-run -r Check the logs

General linux performance troubleshooting

Here's a list of commands that you should execute and then share the output to someone who can help you figure out what resource is the bottleneck in your system. Note, it requires the  sysstat  and  procps  packages (ubuntu and RHEL and its derivatives): uptime vmstat 1 10 iostat -xN 2 10 mpstat -P ALL 3 10 pidstat 1 10 free -mw (or free -m, if your OS doesn't support -w)  uptime is to see the load averages on the system. vmstat is mostly used to tell if the system is swapping or not. If you see significant numbers in the 'si' and 'so' columns, your system is most likely swapping (using the hard drive as RAM), which usually slows performance a lot. iostat is mostly used to determine if your disk subsystem is not able to cope with the load. If you see one or more lines that shows 100 or close almost constantly, it is probably the case.  If it is your swap volume, you probably saw numbers in the 'si' and 'so' columns in the  vmsta

General Linux performance troubleshooting

Here's a list of commands that you should execute and then share the output to someone who can help you figure out what resource is the bottleneck in your system. Note, it requires the sysstat and  procps packages (ubuntu and RHEL and its derivatives): vmstat 1 10 iostat -xN 2 10 mpstat -P ALL 3 10 The first one is mostly used to tell if the system is swapping or not. If you see numbers in the 'si' and 'so' columns, your system is most likely swapping (using the hard drive as RAM), which usually slows performance a lot. The second one is mostly used to determine if your disk subsystem is not able to cope with the load. If you see one or more lines that shows 100 or close almost constantly, it is probably the case.  If it is your swap volume, you probably saw numbers in the 'si' and 'so' columns in the  vmstat  output. The third one shows the % of the CPU time used by different functions of the server. I'll explain the most used one