mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-14 17:02:56 +00:00
demo scripts
This commit is contained in:
5
demo0.sh
Executable file
5
demo0.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o xtrace # Print each command before execution
|
||||
|
||||
PGPASSWORD=password psql -h localhost -U postgres -p 8432 -d dockercplane -c "select name, postgres_version from branches where deleted=false;"
|
||||
38
demo1.sh
Executable file
38
demo1.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o xtrace # Print each command before execution
|
||||
|
||||
cargo neon stop
|
||||
rm -rf .neon
|
||||
|
||||
sleep 4
|
||||
|
||||
cargo neon init
|
||||
|
||||
sleep 3
|
||||
|
||||
cargo neon start
|
||||
sleep 3
|
||||
|
||||
export TENANT_ID=14719455a7fbf1d257f427377d096cc2
|
||||
cargo neon tenant create --pg-version 15 --tenant-id $TENANT_ID
|
||||
|
||||
sleep 1
|
||||
|
||||
cargo neon endpoint create main --pg-version 15 --tenant-id $TENANT_ID
|
||||
|
||||
sleep 1
|
||||
|
||||
cargo neon endpoint start main
|
||||
cargo neon endpoint list --tenant-id $TENANT_ID
|
||||
|
||||
sleep 3
|
||||
|
||||
./pg_install/v15/bin/pgbench -i -s 10 -p 55432 -h 127.0.0.1 -U cloud_admin postgres
|
||||
|
||||
# This endpoint runs on version 15
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "select version();"
|
||||
psql -p 55432 -h 127.0.0.1 -U cloud_admin postgres -c "select pg_current_wal_lsn()"
|
||||
psql -p 55432 -h 127.0.0.1 -U cloud_admin postgres -c "\d+"
|
||||
|
||||
|
||||
41
demo2.sh
Executable file
41
demo2.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -o xtrace # Print each command before execution
|
||||
|
||||
# stop endpoint. Right now this is important, because pg_upgrade will start it
|
||||
# This is not strictly needed, so with some hacking we can implement upgrade without a pause.
|
||||
|
||||
cargo neon endpoint stop main
|
||||
cargo neon endpoint list --tenant-id $TENANT_ID
|
||||
|
||||
# Let's create branch with new major postgres version
|
||||
# !This is the feature that we developed during the hackathon!
|
||||
# everything else is setup and checks
|
||||
|
||||
cargo neon timeline branch --tenant-id $TENANT_ID --pg-version 16 --branch-name branch_16
|
||||
|
||||
# create and start endpoint on it
|
||||
cargo neon endpoint create ep_16 --pg-version 16 --tenant-id $TENANT_ID --branch-name branch_16
|
||||
|
||||
cargo neon endpoint start ep_16
|
||||
|
||||
# let's ensure that this new endpoint runs on a new version
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "select version();"
|
||||
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "select pg_current_wal_lsn()"
|
||||
|
||||
|
||||
# This will show 0 bytes size for all user relations
|
||||
# This is a known issue.
|
||||
# New timeline doesn't have these extensions, we will read them from parent.
|
||||
# Now relsize cache for them is also empty. After SeqScan this size cache fill be correct.
|
||||
# We need to copy the relsize cache from parent timeline.
|
||||
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "\d+"
|
||||
|
||||
# And as you can see, there is some data in the new endpoint.
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "select count(*) from pgbench_accounts;"
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "select count(*) from pgbench_branches;"
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "select count(*) from pgbench_tellers;"
|
||||
|
||||
psql -p 55434 -h 127.0.0.1 -U cloud_admin postgres -c "\d+"
|
||||
Reference in New Issue
Block a user