Postgresql Replication Second Edition

Total Page:16

File Type:pdf, Size:1020Kb

Postgresql Replication Second Edition www.allitebooks.com PostgreSQL Replication Second Edition Leverage the power of PostgreSQL replication to make your databases more robust, secure, scalable, and fast Hans-Jürgen Schönig BIRMINGHAM - MUMBAI www.allitebooks.com PostgreSQL Replication Second Edition Copyright © 2015 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: August 2013 Second edition: July 2015 Production reference: 1240715 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78355-060-9 www.packtpub.com www.allitebooks.com Credits Author Project Coordinator Hans-Jürgen Schönig Vijay Kushlani Reviewers Proofreader Swathi Kurunji Safis Editing Jeff Lawson Maurício Linhares Indexer Priya Sane Shaun M. Thomas Tomas Vondra Graphics Sheetal Aute Commissioning Editor Kartikey Pandey Production Coordinator Komal Ramchandani Acquisition Editor Larissa Pinto Cover Work Komal Ramchandani Content Development Editor Nikhil Potdukhe Technical Editor Manali Gonsalves Copy Editors Dipti Mankame Vikrant Phadke www.allitebooks.com About the Author Hans-Jürgen Schönig has 15 years of experience with PostgreSQL. He is the CEO of a PostgreSQL consulting and support company called Cybertec Schönig & Schönig GmbH (www.postgresql-support.de). It has successfully served countless customers around the globe. Before founding Cybertec Schönig & Schönig GmbH in 2000, he worked as a database developer at a private research company focusing on the Austrian labor market, where he primarily focused on data mining and forecast models. He has also written several books about PostgreSQL. This book is dedicated to all the members of the Cybertec family, who have supported me over the years and have proven to be true professionals. Without my fellow technicians here at Cybertec, this book would not have existed. I especially want to thank Ants Aasma for his technical input and Florian Ziegler for helping out with the proofreading and graphical stuff. Special thanks also go to my girl, Sonja Städtner, who has given me all the personal support. Somehow, she managed to make me go to sleep when I was up late at night working on the initial drafts. www.allitebooks.com About the Reviewers Swathi Kurunji is a software engineer at Actian Corporation. She recently completed her PhD in computer science from the University of Massachusetts Lowell (UMass Lowell), USA. She has a keen interest in database systems. Her PhD research involved query optimization, big data analysis, data warehousing, and cloud computing. Swathi has shown excellence in her field of study through research publications at international conferences and in journals. She has received awards and scholarships from UMass Lowell for research and academics. Swathi also has a master's of science degree in computer science from UMass Lowell and a bachelor's of engineering degree in information science from KVGCE in India. During her studies at UMass Lowell, she worked as a teaching assistant, helping professors in teaching classes and labs, designing projects, and grading exams. She has worked as a software development intern with IT companies such as EMC and SAP. At EMC, she gained experience on Apache Cassandra data modeling and performance analysis. At SAP, she gained experience on the infrastructure/cluster management components of the Sybase IQ product. She has also worked with Wipro Technologies in India as a project engineer, managing application servers. She has extensive experience with database systems such as Apache Cassandra, Sybase IQ, Oracle, MySQL, and MS Access. Her interests include software design and development, big data analysis, optimization of databases, and cloud computing. Her LinkedIn profile is http://www.linkedin.com/pub/swathi- kurunji/49/578/30a/. Swathi has previously reviewed two books, Cassandra Data Modeling and Analysis and Mastering Apache Cassandra, both by Packt Publishing. I would like to thank my husband and my family for all their support. www.allitebooks.com Jeff Lawson has been a user and fan of PostgreSQL since he noticed it in 2001. Over the years, he has also developed and deployed applications for IBM DB2, Oracle, MySQL, Microsoft SQL Server, Sybase, and others, but he has always preferred PostgreSQL because of its balance of features and openness. Much of his experience has spanned development for Internet-facing websites and projects that required highly scalable databases with high availability or provisions for disaster recovery. Jeff currently works as the director of software development at FlightAware, which is an airplane tracking website that uses PostgreSQL and other pieces of open source software to store and analyze the positions of thousands of flights that fly worldwide every day. He has extensive experience in software architecture, data security, and networking protocol design because of his roles as a software engineer at Univa/ United Devices, Microsoft, NASA's Jet Propulsion Laboratory, and WolfeTech. He was a founder of distributed.net, which pioneered distributed computing in the 1990s, and continues to serve as the chief of operations and a member of the board. He earned a BSc in computer science from Harvey Mudd College. Jeff is fond of cattle, holds an FAA private pilot certificate, and owns an airplane in Houston, Texas. Maurício Linhares is a technical leader of the parsing and machine learning team at The Neat Company. At Neat, he helps his team scale their solutions on the cloud and deliver fast results to customers. He is the creator and maintainer of async, a Scala-based PostgreSQL database driver (https://github.com/mauricio/ postgresql-async), and has been a PostgreSQL user and proponent for many years. Shaun M. Thomas has been working with PostgreSQL since late 2000. He has presented at Postgres open conferences in 2011, 2012, and 2014 on topics such as handling extreme throughput, high availability, server redundancy, failover techniques, and system monitoring. With the recent publication of Packt Publishing's PostgreSQL 9 High Availability Cookbook, he hopes to make life easier for DBAs using PostgreSQL in enterprise environments. Currently, Shaun serves as the database architect at Peak6, an options trading firm with a PostgreSQL constellation of over 100 instances, one of which is over 15 TB in size. He wants to prove that PostgreSQL is more than ready for major installations. www.allitebooks.com Tomas Vondra has been working with PostgreSQL since 2003, and although he had worked with various other databases—both open-source and proprietary—he instantly fell in love with PostgreSQL and the community around it. He is currently working as an engineer at 2ndQuadrant, one of the companies that provide support, training, and other services related to PostgreSQL. Previously, he worked as a PostgreSQL specialist for GoodData, a company that operates a BI cloud platform built on PostgreSQL. He has extensive experience with performance troubleshooting, tuning, and benchmarking. In his free time, he usually writes PostgreSQL extensions or patches, or he hacks something related to PostgreSQL. www.allitebooks.com www.PacktPub.com Support files, eBooks, discount offers, and more For support files and downloads related to your book, please visit www.PacktPub.com. Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub. com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks. TM https://www2.packtpub.com/books/subscription/packtlib Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books. Why subscribe? • Fully searchable across every book published by Packt • Copy and paste, print, and bookmark content • On demand and accessible via a web browser Free access for Packt account holders If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access. www.allitebooks.com Table of Contents Preface xi Chapter 1: Understanding the Concepts of Replication 1 The CAP theorem and physical limitations of replication 2 Understanding the CAP theorem 2 Understanding the limits of physics 4 Different types of replication 5 Synchronous versus asynchronous replication
Recommended publications
  • Cruise Shipboard Property Management System Security Guide Release 19.1 F20778-01
    Oracle® Hospitality Cruise Shipboard Property Management System Security Guide Release 19.1 F20778-01 February 2020 Copyright © 1995, 2020, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government. This software or hardware is developed for general use in a variety of information management applications.
    [Show full text]
  • Tools User Guide Release 8.0 E84869-03
    Oracle® Hospitality Cruise Shipboard Property Management System Tools User Guide Release 8.0 E84869-03 December 2019 Copyright © 1995, 2019, Oracle and/or its affiliates. All rights reserved. This software and related documentation are provided under a license agreement containing restrictions on use and disclosure and are protected by intellectual property laws. Except as expressly permitted in your license agreement or allowed by law, you may not use, copy, reproduce, translate, broadcast, modify, license, transmit, distribute, exhibit, perform, publish, or display any part, in any form, or by any means. Reverse engineering, disassembly, or decompilation of this software, unless required by law for interoperability, is prohibited. The information contained herein is subject to change without notice and is not warranted to be error-free. If you find any errors, please report them to us in writing. If this software or related documentation is delivered to the U.S. Government or anyone licensing it on behalf of the U.S. Government, then the following notice is applicable: U.S. GOVERNMENT END USERS: Oracle programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, delivered to U.S. Government end users are "commercial computer software" pursuant to the applicable Federal Acquisition Regulation and agency-specific supplemental regulations. As such, use, duplication, disclosure, modification, and adaptation of the programs, including any operating system, integrated software, any programs installed on the hardware, and/or documentation, shall be subject to license terms and license restrictions applicable to the programs. No other rights are granted to the U.S. Government.
    [Show full text]
  • Forensic Attribution Challenges During Forensic Examinations of Databases
    Forensic Attribution Challenges During Forensic Examinations Of Databases by Werner Karl Hauger Submitted in fulfilment of the requirements for the degree Master of Science (Computer Science) in the Faculty of Engineering, Built Environment and Information Technology University of Pretoria, Pretoria September 2018 Publication data: Werner Karl Hauger. Forensic Attribution Challenges During Forensic Examinations Of Databases. Master's disser- tation, University of Pretoria, Department of Computer Science, Pretoria, South Africa, September 2018. Electronic, hyperlinked versions of this dissertation are available online, as Adobe PDF files, at: https://repository.up.ac.za/ Forensic Attribution Challenges During Forensic Examinations Of Databases by Werner Karl Hauger E-mail: [email protected] Abstract An aspect of database forensics that has not yet received much attention in the aca- demic research community is the attribution of actions performed in a database. When forensic attribution is performed for actions executed in computer systems, it is nec- essary to avoid incorrectly attributing actions to processes or actors. This is because the outcome of forensic attribution may be used to determine civil or criminal liabil- ity. Therefore, correctness is extremely important when attributing actions in computer systems, also when performing forensic attribution in databases. Any circumstances that can compromise the correctness of the attribution results need to be identified and addressed. This dissertation explores possible challenges when performing forensic attribution in databases. What can prevent the correct attribution of actions performed in a database? The first identified challenge is the database trigger, which has not yet been studied in the context of forensic examinations. Therefore, the dissertation investigates the impact of database triggers on forensic examinations by examining two sub questions.
    [Show full text]
  • Lighting Application Suite
    Lighting Application Suite 7.0 System Manual Lighting Application Suite 7.0 System Manual (original version) Edition: 04.03.15 Published by: Traxon Technologies Europe GmbH Karl Schurz-Strasse 38 Paderborn, Germany ©2014, Traxon Technologies Europe GmbH All rights reserved Comments to: [email protected] Available for free download from www.traxontechnologies.com Subject to modification without prior notice. Typographical and other errors do not justify any claim for damages. All dimensions should be verified using an actual part. Except for internal use, relinquishment of the instructions to a third party, duplication in any type or form - also extracts - as well as exploitation and/or communication of the contents is not permitted. e:cue Lighting Application Suite: - Contents 1 Changes in LAS 7.0 9 1.1 Programmer .................................................................................................. 9 2 Introduction 11 2.1 The Lighting Application Suite ....................................................................... 11 2.2 About this book ............................................................................................. 11 3 How to use this manual 12 3.1 Previous knowledge ...................................................................................... 12 3.2 Levels............................................................................................................ 12 4 About the LAS 13 4.1 Objectives ....................................................................................................
    [Show full text]
  • Oracle Database from Wikipedia, the Free Encyclopedia Jump To: Navigation, Search Oracle Database
    The most important program that runs on a computer. Every general-purpose computer must have an operating system to run other programs. Operating systems perform basic tasks, such as recognizing input from the keyboard, sending output to the display screen, keeping track of files and directories on the disk, and controlling peripheral devices such as disk drives and printers. For large systems, the operating system has even greater responsibilities and powers. It is like a traffic cop -- it makes sure that different programs and users running at the same time do not interfere with each other. The operating system is also responsible for security, ensuring that unauthorized users do not access the system. Operating systems can be classified as follows: # multi-user : Allows two or more users to run programs at the same time. Some operating systems permit hundreds or even thousands of concurrent users. # multiprocessing : Supports running a program on more than one CPU. # multitasking : Allows more than one program to run concurrently. # multithreading : Allows different parts of a single program to run concurrently. # real time: Responds to input instantly. General-purpose operating systems, such as DOS and UNIX, are not real-time. Operating systems provide a software platform on top of which other programs, called application programs, can run. The application programs must be written to run on top of a particular operating system. Your choice of operating system, therefore, determines to a great extent the applications you can run. For PCs, the most popular operating systems are DOS, OS/2, and Windows, but others are available, such as Linux.
    [Show full text]
  • Table of Contents
    keeptool User’s Guide Version 6.2.0 KeepTool User’s Guide Page 1 Version 6.2.0 Table of Contents Table Of Contents TABLE OF CONTENTS........................................................................................2 !GETTING STARTED.....................................................................................16 About KeepTool........................................................................................................... 17 System Requirements ................................................................................................. 17 Workstation Requirements ..................................................................................................... 17 Server Requirements.............................................................................................................. 17 Installation.................................................................................................................... 18 License Agreement...................................................................................................... 20 Free 30-day Trial Period ......................................................................................................... 20 License Agreement for Registered Users............................................................................... 21 Copyright................................................................................................................................. 21 3rd party components ............................................................................................................
    [Show full text]
  • Outputting Event Log Events to a Remote SQL Database Using Powershell
    Peter McEldowney Mark Waddington | Capstone CSNT 255 Outputting Event Log Events to a Remote SQL Database Using PowerShell Objective: After completing this lab, the Administrator will have the Event Log from the computer of their choice uploading information to a SQL database. The step-by-step outlines how to create the tables that will be used to organize the data and will cover how to create a basic SQL script to create these tables. Within the script to create the tables, indexes will be covered to ensure quick access to the data by a particular column that is indexed and will also cover items to be aware of. After creating these tables, a script to upload the event log items to the SQL server will be created so that the script can be run from any machine to ensure scalability. After the script is created and tested, this step-by-step will go through how to create a trigger that will run the script whenever a new event log entry is created. Requirements: PowerShell 3.0, Microsoft SQL Server [w/ Management Tools] Step 1 : Create a diagram of the tables that will be used to store the data Considerations when designing your tables: a) What data is available? b) How will you identify the machine once the data is in the database? c) What log did the data come from and how will this be stored in the database? d) Is there an efficient way to organize the data to make retrieving the data quicker? e) What columns will people be searching from? f) What should the Primary Keys for the table(s) be? What is a Primary Key? A primary key is basically an index number.
    [Show full text]
  • Implementation Best Practice Guide
    Implementation Best Practice Guide Version 1.0 Release July 2016 Lexmark believes the information in this publication is accurate as of its publication date. The information is subject to change without notice. The information in this publication is provided as is. Lexmark makes no representations or warranties of any kind with respect to the information in this publication, and specifically disclaims implied warranties of merchantability or fitness for a particular purpose. Use, copying, and distribution of any Lexmark software described in this publication requires an applicable software license. For information on Lexmark product names and trademarks, visit Lexmark.com. All other trademarks used herein are the property of their respective owners. © Copyright 2016 Lexmark International, Inc. All rights reserved. Table of Contents Contents 1. OVERVIEW ............................................................................................................... 4 1.1. Purpose ...................................................................................................... 4 1.2. Intended Audience ...................................................................................... 4 1.3. Revision History .......................................................................................... 4 1.4. References ................................................................................................. 4 2. GLOSSARY .............................................................................................................
    [Show full text]
  • E-Maj Documentation Release 4.0.0 Philippe Beaudoin
    E-Maj Documentation Release 4.0.0 Philippe Beaudoin Sep 17, 2021 Overview: 1 Introduction 1 2 Concepts 3 3 Architecture 5 4 Quick start 9 5 Installing the E-Maj software 11 6 E-Maj extension setup 13 7 Upgrade an existing E-Maj version 17 8 Uninstalling an E-Maj extension from a database 23 9 PostgreSQL version upgrade 25 10 Set-up the E-Maj access policy 27 11 Creating and dropping tables groups 29 12 Main functions 35 13 Modifying tables groups 43 14 Other groups management functions 51 15 Marks management functions 57 16 Statistics functions 61 17 Data extraction functions 65 18 Other functions 69 19 Multi-groups functions 75 20 Parallel Rollback client 77 i 21 Rollback monitoring client 81 22 Parameters 83 23 Log tables structure 85 24 Reliability 87 25 Traces of operations 89 26 The E-Maj rollback under the Hood 93 27 Impacts on instance and database administration 97 28 Sensitivity to system time change 103 29 Performance 105 30 Usage limits 107 31 User’s responsibility 109 32 Emaj_web overview 111 33 Installing the Emaj_web client 113 34 Using Emaj_web 115 35 Contribute to the E-Maj development 127 36 E-Maj functions list 135 37 E-Maj distribution content 143 38 PostgreSQL and E-Maj versions compatibility matrix 145 39 Indices and tables 147 ii CHAPTER 1 Introduction 1.1 License This extension and its documentation are distributed under GPL license (GNU - General Public License). 1.2 E-Maj’s objectives E-Maj is the French acronym for “Enregistrement des Mises A Jour”, which means “updates recording”.
    [Show full text]
  • Database Concepts © Leo Mark 1 DATABASE CONCEPTS
    Database Concepts © Leo Mark 1 DATABASE CONCEPTS Leo Mark College of Computing Georgia Tech (January 1999) Database Concepts © Leo Mark 2 Course Contents Introduction Database Terminology Data Model Overview Database Architecture Database Management System Architecture Database Capabilities People That Work With Databases The Database Market Emerging Database Technologies What You Will Be Able To Learn More About Database Concepts © Leo Mark 3 INTRODUCTION What a Database Is and Is Not Models of Reality Why use Models? A Map Is a Model of Reality A Message to Map Makers When to Use a DBMS? Data Modeling Process Modeling Database Design Abstraction Database Concepts © Leo Mark 4 What a Database Is and Is Not The word database is commonly used to refer to any of the following: your personal address book in a Word document a collection of Word documents a collection of Excel Spreadsheets a very large flat file on which you run some statistical analysis functions data collected, maintained, and used in airline reservation data used to support the launch of a space shuttle Database Concepts © Leo Mark 5 Models of Reality DML DATABASE SYSTEM REALITY structures DATABASE processes DDL A database is a model of structures of reality The use of a database reflect processes of reality A database system is a software system which supports the definition and use of a database DDL: Data Definition Language M M DatabaseD ConceptsL: Data anipulation Language © Leo Mark 6 Why Use Models? Models can be useful when we want
    [Show full text]
  • Postgresql Server Programming
    PostgreSQL Server Programming Extend PostgreSQL and integrate the database layer into your development framework Hannu Krosing Jim Mlodgenski Kirk Roybal BIRMINGHAM - MUMBAI PostgreSQL Server Programming Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: June 2013 Production Reference: 1180613 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84951-698-3 www.packtpub.com Cover Image by Hannu Krosing ([email protected]) Credits Authors Project Coordinator Hannu Krosing Shraddha Vora Jim Mlodgenski Kirk Roybal Proofreader Joel T. Johnson Reviewer Gabriele Bartolini Indexer Priya Subramani Acquisition Editor Sarah Cullington Graphics Ronak Dhruv Lead Technical Editor Susmita Panda Production Coordinator Arvindkumar Gupta Technical Editors Veronica Fernandes Cover Work Arvindkumar Gupta Vaibhav Pawar Kirti Pujari Amit Ramadas About the Authors Hannu Krosing was a PostgreSQL user before it was rewritten to use SQL as its main query language in 1995.
    [Show full text]
  • Keeptool 10.0
    KeepTool 10 Manual KeepTool 10.0 © 2011 KeepTool GmbH All rights reserved. No parts of this work may be reproduced in any form or by any means - graphic, electronic, or mechanical, including photocopying, recording, taping, or information storage and retrieval systems - without the written permission of the publisher. Products that are referred to in this document may be either trademarks and/or registered trademarks of the respective owners. The publisher and the author make no claim to these trademarks. While every precaution has been taken in the preparation of this document, the publisher and the author assume no responsibility for errors or omissions, or for damages resulting from the use of information contained in this document or from the use of programs and source code that may accompany it. In no event shall the publisher and the author be liable for any loss of profit or any other commercial damage caused or alleged to have been caused directly or indirectly by this document. Printed: November 2011 in Germany Contents 3 Table of Contents Part I Getting Started 13 1 Ab.o..u..t. .K..e..e..p..T..o..o..l. ............................................................................................................. 13 2 Sy.s.t.e..m... .R...e..q..u..i.r.e..m...e..n..t.s. .................................................................................................... 14 3 Pri.c..e..s.. ............................................................................................................................ 15 4 Ins.t.a..l.l.a..t.i.o..n.. .o..f. .K...e..e..p..T..o..o..l. ................................................................................................ 15 5 Lic..e..n..s.e.. .A..g..r..e..e..m...e..n..t. ....................................................................................................... 17 6 Re.g..i.s..t.e..r.i.n..g.
    [Show full text]