Code Monkey home page Code Monkey logo

codesanook-sql-server-replication-setup-script's Introduction

Basic replication presentation (Google slide)

To use this example

  • Launch a new PowerShell terminal.
  • Start SQL Server docker containers.
  • CD to docker folder.
  • Create a new file 'sa_password.secret' and put a strong sa's password to this file. Please make sure that you use LF line feed.

Optionally, you may need to run the following commands if files get converted to CRLF

$path = ".\sa_password.secret"; (Get-Content $path -Raw).Replace("rn", "`n") | Set-Content $Path -NoNewline -Force
$path = ".\entrypoint.sh"; (Get-Content $path -Raw).Replace("rn", "`n") | Set-Content $Path -NoNewline -Force

  • Run a docker-compose command with a following command.
    docker-compose up

Alternatively, if you want to force build an image, use

    docker-compose up --build
  • Wait for a while and you will have publisher, distributor and subscriber instances.
  • You can connect to each SQL Server instance with this information .
  • publisher: localhost, 2000
  • distributor: localhost, 2001
  • subscriber: localhost, 2002

Create a new database and setup replication

  • Launch a new PowerShell terminal.
  • CD to the root of the project.
  • Execute the following commmand to setup replication.
    .\Install-Replication.ps1
  • After setup successfully, you will have a new database with replication.

Testing a replication

  • Run New-DatabaseRecord.ps1. It will excute stored proc to insert a new record to publisher and then select records from subscription database.
    .\New-DatabaseRecord.ps1

Troubleshooting

Your SQL Sever is very slow or cannot create all instances

  • For multiple containers, you may need to add ram to 6 GB because each SQL Server instance can consume up to 2 GB.

codesanook-sql-server-replication-setup-script's People

Contributors

aaronamm avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.