Steps with explanations to set up a server using:
- Virtualenv
- Virtualenvwrapper
- Django
- Gunicorn
source :rubygems | |
gem "puma" | |
gem "sinatra" |
#MongoDB 3.2.x Sharding Sharding is used when the database is too large to run on a single server and you need to spread the load across multiple servers. The name itself refers to the breaking (sharding) of the data into seperate groups of data which will reside on different servers.
##Configuration Server Start the server on your server (myserver0)
mongod --configsvr --dbpath /data
On myserver1 start the shard giving the configuration server as the --configdb
option
Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.
The following steps assume you've got a set-up like mine, where:
select | |
test, | |
query::char(48), | |
instance, | |
--scale, | |
--clients, | |
round(mean_time::numeric, 4) mean_time, | |
round(stddev_time::numeric, 4) stddev_time, | |
round(((mean_time - mean_time_lag)::numeric / mean_time::numeric )*100, 1) as mean_time_diff, | |
round(((stddev_time - stddev_time_lag)::numeric / stddev_time::numeric )*100, 1) as stddev_time_diff |
SELECT * | |
FROM ( | |
SELECT | |
( | |
SELECT concat('Marie-', string_agg(x,'-')) as name_first_female | |
FROM ( | |
select start_arr[ 1 + ( (random() * 100)::int) % 32 ] | |
FROM | |
( | |
select '{Claude,Thérèse,Géraldine,Sylvie,Sophie,Solange,Vivianne,Cunégonde,Albertine,Charlotte,Caroline,Célestine,Bérangère,Sylvianne,Alphonsine,Claire,Françoise,Chantal,Geneviève,Christine,Louise,Adeline,Céleste,Angélique,Clothilde,Jeanne,Pierre,Valentine,Paule,Noëlle,Lise,Cécile}'::text[] as start_arr |
-- So as an example of using a log orientated approach in PostgreSQL, | |
-- let's write a simple blog application. We will want to be able to: | |
-- * Write and edit blog posts | |
-- * Publish revisions of posts for public viewing | |
-- * Delete posts | |
-- * Add or remove tags to posts | |
-- Let's start by creating a schema. |
# Sharding within Foreign Data Wrappers and Inheritance [WIP] | |
Previous sources: | |
https://www.depesz.com/2015/04/02/waiting-for-9-5-allow-foreign-tables-to-participate-in-inheritance/ | |
http://snowman.net/slides/pgfdw_sharding.pdf | |
Postgres 10 next things: | |
https://wiki.postgresql.org/wiki/Built-in_Sharding | |
<logical replication> |
CREATE OR REPLACE FUNCTION public.clone_schema( | |
source_schema text, | |
dest_schema text) | |
RETURNS void AS | |
$BODY$ | |
DECLARE | |
object text; | |
buffer text; | |
default_ text; | |
column_ text; |