This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ruby -r json -r csv -e 'puts CSV.parse(STDIN, headers:true).map(&:to_h).to_json' < INPUT.csv |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Installing pg 1.2.3 with native extensions | |
| Gem::Ext::BuildError: ERROR: Failed to build gem native extension. | |
| current directory: ../.rvm/gems/ruby-2.6.3/gems/pg-1.2.3/ext | |
| /usr/share/rvm/rubies/ruby-2.6.3/bin/ruby -I /usr/share/rvm/rubies/ruby-2.6.3/lib/ruby/2.6.0 -r ./siteconf20210901-306426-52o4ch.rb extconf.rb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [How To] Fix psql version 9.2, server version 9.5 warning | |
| If you have more than one version of PostgreSQL installed in your Linux server, which is very common given the older version of the database shipped with most stable server distros, you may end up with the following warning when trying to login to the database console | |
| bash-4.1$ psql | |
| psql (9.2.9, server 9.5.1) | |
| WARNING: psql version 9.2, server version 9.5. | |
| Some psql features might not work. | |
| Type "help" for help. | |
| postgres=# \q |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| get from https://help.theatremanager.com/book/export/html/3665 | |
| ************************************************************ | |
| Promoting a Standby to the Main server | |
| ************************************************************ | |
| Except for an absolute calamity, there is no reason to promote the hot standby to be the main server. If you need to, the general recovery steps are outlined below. There is only ONE command to do at the backup server to make it the primary server (see bottom half of page). | |
| 1. Shut down, turn off, unplug and/or remove the main server from the network so that it is no longer active | |
| 2. On the backup server, create the failover trigger file using the primary failover methodology (described in detail below): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- display configurations | |
| --- max connections set up | |
| SELECT name, current_setting(name) | |
| FROM pg_settings | |
| WHERE name = 'max_connections' | |
| --- display config file | |
| show config_file; | |
| --- display effective cache size |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ cd /tmp | |
| $ wget http://download.redis.io/redis-stable.tar.gz | |
| $ tar xvzf redis-stable.tar.gz | |
| $ cd redis-stable | |
| $ make | |
| $ cp src/redis-cli /usr/local/bin/ | |
| $ chmod 755 /usr/local/bin/redis-cli |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Exclude postgresql* on yum repos | |
| $ vim /etc/yum.repos.d/CentOS-Base.repo | |
| ** [base] | |
| name=CentOS-$releasever - Base | |
| mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os | |
| #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ | |
| gpgcheck=1 | |
| gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pg_dump: server version: #.##.#; pg_dump version: #.##.# | |
| How to fix: | |
| 1. Check the installed version(s) of pg_dump | |
| $ find / -name pg_dump -type f 2>/dev/null | |
| 2. List of output | |
| $ /usr/bin/pg_dump | |
| $ /usr/pgsql-9.4/bin/pg_dump | |
| $ /usr/pgsql-9.6/bin/pg_dump |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * Install official PostgreSQL contrib package | |
| $ yum install postgresql93-contrib | |
| * Create extension | |
| $ create extension pg_stat_statements; | |
| * Edit postgresql.conf | |
| $ vim /var/lib/pgsql/9.3/data/postgresql.conf | |
| ** add | |
| shared_preload_libraries = pg_stat_statements (required) | |
| track_activity_query_size = 2048 (increase maximum length before which queries are truncated) | |
| pg_stat_statements.track = ALL (track all statements, including those inside stored procedures) |