フィードアグリゲーター

Shaun M. Thomas: PG Phriday: Postgres 12 Revs up Vacuum

planet postgresql - 2019-09-07(土) 02:00:44
Any long-time user of Postgres is likely familiar with VACUUM, the process that ensures old data tuples are identified and reused to prevent unchecked database bloat. This critical element of maintenance has slowly, but surely, undergone incremental enhancements with each subsequent release. Postgres 12 is no different in this regard. In fact, there are two […]
カテゴリー: postgresql

PHP Town Hall: Episode 68: Behind the Facade

phpdeveloper.org - 2019-09-06(金) 23:30:02

Matt Trask and Ben Edmunds are joined by Taylor Otwell to discuss what’s new with Laravel, the business side of things, and what it’s like organizing a huge conference.

Links

Laravel Forge Vapor Ignition

カテゴリー: php

Muhammad Usama: Can you gain performance with Pgpool-II as a load balancer?

planet postgresql - 2019-09-06(金) 23:26:30

The world’s most valuable resource is no longer the oil or gold, but data. And at the heart of data lies the database which is expected to store, process and retrieve the desired data as quickly as possible. But having a single database server doesn’t mostly serve the purpose. A single server has its drawbacks with a huge risk of data loss and downtime.

So most data platforms use multiple replicated database servers to ensure high availability and fault tolerance of their databases. In such an environment, how can we maximize performance against the resourced being used?

One of the questions I get asked very often from Pgpool-II users is, what is the performance benefit of using load balancing of Pgpool-II? Once in a while, we get complains from users that they get better performance when they connect directly to PostgreSQL than through Pgpool-II, even when the load balancing is working fine. How true is this complain?

In this blog, I’ll benchmark the performance of the Pgpool-II load balancing feature against a direct connection to PostgreSQL.

Before we start measuring the actual performance, let’s start with what is Pgpool-II load balancer and why we should use it.

Replicated PostgreSQL servers.

Almost in every data setup, we need more than one copy of database servers to ensure minimum or zero downtime and to safeguard against data loss. For that, we use the replicated database servers.

There are many ways to create a replicated PostgreSQL cluster, which is the topic for some other blog post, but most of the replication solution exists for PostgreSQL supports one-way replication. That means one master PostgreSQL server feeding data to one or multiple standby servers. and in this setup, only maser server is capable of handling the write queries while standby servers sit idle waiting for the moment when the master goes down and one of them gets promoted to become a new master.

This setup is good enough to handle server failures and to provide the high availability but it is not

[...]
カテゴリー: postgresql

PHP on the road to the 7.4.0 release

planet PHP - 2019-09-06(金) 17:35:00

Version 7.4.0RC1 is released. It's now enter the stabilisation phase for the developers, and the test phase for the users.

RPM are available in the remi-php74 repository for Fedora  29 and Enterprise Linux  7 (RHEL, CentOS) and as Software Collection in the remi-safe repository (or remi for Fedora)

 

The repository provides development versions which are not suitable for production usage.

Also read: PHP 7.4 as Software Collection

Installation : read the Repository configuration and choose installation mode.

Replacement of default PHP by version 7.4 installation, module way (simplest way on Fedora and EL-8):

dnf module disable php dnf module install php:remi-7.4 dnf update

Replacement of default PHP by version 7.4 installation, repository way (simplest way on EL-7):

yum-config-manager --enable remi-php74 yum update php\*

Parallel installation of version 7.4 as Software Collection (x86_64 only, recommended for tests):

yum install php74

To be noticed :

  • EL7 rpm are build using RHEL-7.6
  • EL6 rpm are build using RHEL-6.10
  • lot of extensions are also available, see the PECL extension RPM status page
  • follow the comments on this page for update until final version.

Information, read:

Base packages (php)

Software Collections (php74)

カテゴリー: php

Interview with Junade Ali

planet PHP - 2019-09-06(金) 12:35:00
カテゴリー: php

Interview with Junade Ali

planet PHP - 2019-09-06(金) 11:05:00
カテゴリー: php

PHP: Hypertext Preprocessor: PHP 7.4.0RC1 Released!

phpdeveloper.org - 2019-09-06(金) 01:30:01

The PHP team is glad to announce the first release candidate of PHP 7.4: PHP 7.4.0RC1. This continues the PHP 7.4 release cycle, the rough outline of which is specified in the PHP Wiki. Please DO NOT use this version in production, it is an early test version. For source downloads of PHP 7.4.0RC1 pl...

カテゴリー: php

Derick Rethans: PHP Internals News: Episode 26: Making Symfony ready for PHP 7.4

phpdeveloper.org - 2019-09-06(金) 00:00:02
PHP Internals News: Episode 26: Making Symfony ready for PHP 7.4 London, UK Thursday, September 5th 2019, 09:26 BST In this episode of "PHP Internals News" I chat with Nicolas Grekas (Twitter, GitHub, LinkedIn, Symfony Connect) about how th...
カテゴリー: php

510 Not Extended

planet PHP - 2019-09-06(金) 00:00:00

[RFC2774][2] is an experimental RFC, that introduces a mechanism to allow developers to extend the HTTP protocol with vendor-specific features in a safe namespaced way.

Around this time many new protocols and systems started to get built on top of HTTP, and the authors might have felt there was a need to do this in a namespaced way.

This is not unlike XML namespaces, where it’s possible for one standards organization to define a new format (for example ATOM), and other corporations wanting to add new properties, avoiding the possibility of collision if a second vendor also introduced a property with the same name.

As far as I know this extension to HTTP can be considered dead.

The 510 Not Extended statuscode could be used when a server requires that a client uses an ‘extended HTTP request’, but didn’t. When a server emits this response, it should also tell the client how to extend the request, but the specification doesn’t specify a format for this.

Because this error is a ‘client error’, it should probably have had a 4xx code, not a 5xx one.

I would not recommend for anyone to use this.

Should I use this?

No. RFC2774 is a very obscure extension to HTTP, and as far as I know has never really been picked up. If you feel you have a need for this, I believe there is likely to be a different way to extend HTTP. Perhaps via content negotiation, or just different kinds of messaging from client to server.

References
カテゴリー: php

PHP 7.4.0RC1 Released!

php.net - 2019-09-05(木) 17:39:13
カテゴリー: php

PHP 7.4.0RC1 Released!

planet PHP - 2019-09-05(木) 09:00:00
The PHP team is glad to announce the first release candidate of PHP 7.4: PHP 7.4.0RC1. This continues the PHP 7.4 release cycle, the rough outline of which is specified in the PHP Wiki. Please DO NOT use this version in production, it is an early test version. For source downloads of PHP 7.4.0RC1 please visit the download page. Please carefully test this version and report any issues found in the bug reporting system. For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes. These files can also be found in the release archive. The next release would be 7.4.0RC2, planned for September 19th. The signatures for the release can be found in the manifest or on the QA site. Thank you for helping us make PHP better.
カテゴリー: php

Akra's DevNotes: Receiving input into a Slim 4 application

phpdeveloper.org - 2019-09-05(木) 05:30:02

A Slim 4 (and Slim 3) application receives data from three places: Any query parameters on the URL (the key-value pairs after the ?) The HTTP message's body (usually for POST and PUT) messages Parameters in the URL (such as the 3 in https://example.com/users/3 Within the application, these are a...

カテゴリー: php

Interview with Junade Ali

planet PHP - 2019-09-05(木) 05:01:00
カテゴリー: php

Jonathan Katz: Creating a PostgreSQL Cluster with Kubernetes CRDs

planet postgresql - 2019-09-05(木) 02:08:00

The PostreSQL Operator provides users with a few different methods to perform PostgreSQL cluster operations, via:

  • a REST API
  • pgo, PostgreSQL Operator Command Line Interface (CLI)
  • Directly interfacing with Kubernetes, including various APIs and custom resource definitions (CRDs).

While the REST API and pgo provide many conveniences, there are use cases that require the third method, i.e. interacting directly with Kubernetes to create the desired PostgreSQL cluster setup.

To demonstrate this, let's look at how we can manipulate the CRD responsible for managing PostgreSQL clusters to create a new cluster managed by the PostgreSQL Operator.

カテゴリー: postgresql

Receiving input into a Slim 4 application

planet PHP - 2019-09-04(水) 19:00:00

A Slim 4 (and Slim 3) application receives data from three places:

  • Any query parameters on the URL (the key-value pairs after the ?)
  • The HTTP message's body (usually for POST and PUT) messages
  • Parameters in the URL (such as the 3 in https://example.com/users/3

Within the application, these are available within the PSR-7 Request object.

Let's start with a simple Slim 4 application.

Firstly we require the Slim framework and a PSR-7 implementation:

$ composer require slim/slim slim/psr7

Now we write public/index.php:

<?php declare(strict_types=1); use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory; require __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); $app->addRoutingMiddleware(); $app->addErrorMiddleware(true, true, true); $app->get('/', function (Request $request, Response $response, $args): Response { // our code for this handler goes here return $response; }); $app->run();

This is the standard minimal Slim 4 application, which will respond solely to the / URL (i.e. the home page of the website) and will return an empty response. See A first look at Slim 4 for more information.

We can run our website with:

$ php -S 0.0.0.0:8888 -t public/

If we navigate to https://localhost:8888 we'll see a blank page.

Query parameters

Query parameters are the key value pairs after the ? in the URL. For example in the ULR http://localhost:8888?name=Rob, we have a parameter name with the value Rob.

To access this in our Slim 4 handler, we use the Request's getQueryParams() method. This will return an array of all query parameter.

i.e. if we add:

// our code for this handler goes here $params = $request->getQueryParams() var_dump($params);

And then navigate to localhost:8888/?name=Rob&country=UK, we will see:

array (size=1) 'name' => string 'Rob' (length=3) 'country' => string 'UK' (length=2)

Note that the PSR-7 RequestInterface doesn't have a method to retrieve a single parameter, so if you just want a one parameter, the easiest way is to use the null coalescing operator (??) like this:

$name = $request->getQueryParameters()['name'] ?? '';

This will either set $name to the value of the name query parameter if it exists or set it to an empty string otherwise

Posted form data

For form data posted to the website from a browser, we can use the $request's getParsedBody() method. This will return an array of the posted data.

Firstly we set up a form:

$app->get('/', function (Request $request, Response $response, $args): Response { $html = <<<html <html> <form method="POST"> <label>Name: <input name="name"></label> <label>Country: <input name="country"></label> <input type="submit"> </form> </html> html; $response->getBody()->write($html); return $response; });

We also need a handler to receive the POSTed data:

$app->post('/', function (Request $request, Response $response, $args): Response { $data = $request->getParsedBody(); $html = var_export($data, true); $response->getBody()->write($html); return $response; });

If we fill out our form with the same name and country as before:

(html/CSS isn't really my forté!)

we'll get:

array ( 'name' => 'Rob', 'country' => 'UK', )

Again, the PSR-7 Request object doesn't have a method to retrieve a single parameter from POSTed data, but in my experience this is rarely a requirement anyway.

POSTed JSON or XML data

It's very common in web APIs to send data in XML or JSON format. Out of the box, PSR-7 implementations do not support these formats, you have to decode the Request object's getBody() yourself. As this is a common requirement, Slim 4 provides BodyParsingMiddleware to handle this task.

This is added using:

$app->addBodyParsing

Truncated by Planet PHP, read more at the original (another 3313 bytes)

カテゴリー: php

Dimitri Fontaine: Postgres Connection Strings and psql

planet postgresql - 2019-09-04(水) 18:38:02

PostgreSQL connection strings embedded in your application can take two different forms: the key-value notation or the postgresql:// URI scheme. When it comes to using psql though, another form of connection string is introduced, with command line options -h -p -U and environment variable support.

In this short article you will learn that you can use either of the three different forms in psql and thus easily copy & paste you application connection string right at the console to test it!

カテゴリー: postgresql

Granthana Biswas: Remote Backup and Restore with pgBackRest

planet postgresql - 2019-09-04(水) 15:30:16

In my previous post about pgBackRest, we saw how to install and setup pgBackRest and make a backup of a PostgreSQL database with it. It was a very basic single server setup,  only intended to get the hang of the tool. Such setups are not used in a production environment, as it is not recommended (or rather does not serve the purpose) to perform the backup on the same server where the database is running.

So: let’s get familiar with how remote backup servers are set up with pgBackRest, and how a full and incremental backup is performed from the backup server and restored on the database server.

We need two servers. Let’s call ours:

  1. pgbackup
  2. db1

 

Installing pgbackrest:

We need to install pgBackRest on the database and the backup server. Make sure you install the same version on both.

 

For the database server, please follow the installation steps from my previous post. The steps are slightly different for the backup server, since it is a better practice to create a separate user to own the pgBackRest repository.

 

Create a pgbackrest user on the backup server

 

sudo adduser --disabled-password --gecos "" pgbackrest

 

Install required Perl package and pgBackRest from a package or manually on pgbackup as below

 

sudo apt-get install libdbd-pg-perl sudo scp BUILD_HOST:/root/pgbackrest-release-2.14/src/pgbackrest /usr/bin/ sudo chmod 755 /usr/bin/pgbackrest

 

Create pgBackRest configuration files, directories and repository on pgbackup

 

sudo mkdir -p -m 770 /var/log/pgbackrest sudo chown pgbackrest:pgbackrest /var/log/pgbackrest sudo mkdir -p /etc/pgbackrest sudo mkdir -p /etc/pgbackrest/conf.d sudo touch /etc/pgbackrest/pgbackrest.conf sudo chmod 640 /etc/pgbackrest/pgbackrest.conf sudo chown pgbackrest:pgbackrest /etc/pgbackrest/pgbackrest.conf sudo mkdir -p /var/lib/pgbackrest sudo chmod 750 /var/lib/pgbackrest sudo chown pgbackrest:pgbackrest /var/lib/pgbackrest

 

Now we are ready to proceed with enabling c

[...]
カテゴリー: postgresql

ページ