Skip to main content

Posts

Backup Postgres SQL format

  Wget /static/scripts.zip Mkdir /backup/database/ Update script BACKUP_DIR pg_backup.config Set password  su - postgres Psql \password root@vindazo /mnt/extradrive/backup/scripts # cp pgpass.conf ~/.pgpass root@vindazo /mnt/extradrive/backup/scripts # chmod 0600 ~/.pgpass It should automatically start backup from script ./pg_backup_rotated.sh Create crontab for daily backup 0 0 * * * /mnt/extradrive/backup/scripts/pg_backup_rotated.sh Check werking over 2 days.. And best monthly control all  backups and create one copy for backup copy.   Backup instellen old fashion vim pg_backup.config   BACKUP_DIR=/home/backup/database/ ./pg_backup_rotated.sh vim /etc/environment         PGPASSFILE="/home/backup/scripts/pgpass.conf"    Install Tartarus       http://wiki.hetzner.de/index.php/Tartarus_Backup-Konfiguration wget http://wertarbyte.de/apt/tartarus/tartarus_0.9.8-1_all.deb   sudo dpkg -i tartarus_0.9.8-1_all.deb - Tartarus configuration  filesbackup.bash -----------------------

Firebase Realtime Database / Cloud Firestore Connection Python Django

It is always interesting to combine firebase with another server such as elasticsearch or crawler or mailing server on a separate server. Then of course a connection is needed, we use python in this example. sudo pip install firebase-admin import firebase_admin from firebase_admin import credentials cred = credentials . Certificate ( "path/to/serviceAccountKey.json" ) firebase_admin . initialize_app ( cred ) https://firebase.google.com/docs/admin/setup#python   Init and Retrieve Data from  https://firebase.google.com/docs/database/admin/start   https://firebase.google.com/docs/database/admin/retrieve-data def handle(self, *args, **options):          cred = credentials.Certificate("/")          firebase_admin.initialize_app(cred, {                  'databaseURL': 'https://database.firebaseio.com'          })          jobs = Job.objects.all()[:3]          ref = db.reference("/jobs")          import pdb;pdb.set_trace()          for job in

Postgres into a distributed database Citus Django Ubuntu

Citus is an open source extension of Postgres that can distribute data and queries among multiple nodes in a cluster. Because Citus is an extension (not a branch) of Postgres, when you use Citus, you are also using Postgres. You can take advantage of the latest Postgres features, tools, and ecosystem. In apt-get I could not add repositories because it is configured by default only have support for only LTS versions of operating systems. I will try manually downloading and installing the package. https://repos.citusdata.com/community/    This repository is all moved…  I found packages on this repository.  https://packagecloud.io/citusdata/community   wget --content-disposition https://packagecloud.io/citusdata/community/packages/ubuntu/focal/postgresql-12-citus-10.0_10.0.2.citus-1_amd64.deb/download.deb   sudo dpkg -i postgresql-12-citus-10.0_10.0.2.citus-1_amd64.deb Package libpq5 is not installed. postgresql-12-citus-10.0 depends on postgresql-12; however Package postgresql-12 is not