User Tools
Writing /app/www/public/data/meta/introduction/distfilesharing/start.meta failed
introduction:distfilesharing:start
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| introduction:distfilesharing:start [2019/08/26 11:59] – mmcc | introduction:distfilesharing:start [2021/06/25 10:09] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Distributed File Sharing ====== | ||
| + | Author: Cathal O' | ||
| + | |||
| + | ===== Introduction ===== | ||
| + | |||
| + | Some of our applications allow users to upload files to the file system, typically photographs. | ||
| + | |||
| + | These files need to be accessible on every instance of the application, | ||
| + | |||
| + | In the SNMP Manager trap rules and MIBs are also kept on the file system and need to kept synchronised between handlers whenever they are updated. | ||
| + | |||
| + | We use a daemon called lsyncd ("el sync") to handle this. Our lsync configurations leverage the unison file syncing tool. | ||
| + | |||
| + | Servers that are running a master or slave sync configuration need both lsyncd and unison installed. Servers that are only receiving pushes and not generating sync updates themselves only need unison installed. | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | ===== Server Configuration ===== | ||
| + | |||
| + | ===Master Server=== | ||
| + | We use a pair of files to configure lsyncd on our servers. | ||
| + | |||
| + | For master servers, the first file is / | ||
| + | |||
| + | The sync script, located at ~/ | ||
| + | |||
| + | ===Active Slave=== | ||
| + | Now we have a master server that copies out all file changes to the slave server when it sees that a file has changed. But what if a file changes on the slave server? We still want to keep files synced across all servers so something needs to happen here two. The slave servers also have two files that make up the configuration. | ||
| + | |||
| + | One is / | ||
| + | |||
| + | ===Other Slaves=== | ||
| + | While not really a server that's been configured. It's worth emphasising that servers do not need to have the above slave configuration running in order to receive updates from master. In this case they will receive updates from the master when a sync event is happening, but updating the files on the slave itself will not cause the master to pull the changes. | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | =====Production Layout===== | ||
| + | |||
| + | **Note:** This master/ slave setup is subject to change when master swaps are performed. To check if you are on the master type the commands: show master status; or show slave status; in the database. | ||
| + | |||
| + | ===Extenet=== | ||
| + | |||
| + | **Master - extapps1** | ||
| + | * Syncs ~/appfiles to extslb, extapps2 and extems | ||
| + | * Syncs ~/ | ||
| + | |||
| + | **Slave - extapps2** | ||
| + | * Syncs ~/appfiles with extapps1 | ||
| + | |||
| + | **Slave - extlb** | ||
| + | * Syncs ~/appfiles with extapps1 | ||
| + | |||
| + | **Slave - extems** | ||
| + | * Syncs ~/appfiles with extapps1 | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | |||
| + | =====Onboarding Self Exercise===== | ||
| + | - SSH to one of our QA app handler servers. | ||
| + | - Locate the appfiles directory and cd into it. | ||
| + | - Create a small text file in this directory named after yourself - e.g. " | ||
| + | - SSH to the other app handler and verify that a copy of the file now exists on it (if it's not there straight away wait a minute). | ||
| + | - Modify this copy of the file. | ||
| + | - Go back to the first app handler and verify that the change is pushed back to the original file after a minute. | ||
| + | - To verify that you've completed this just do an 'ls -l' on the directory with the file in it and take a screenshot of your terminal window. | ||
| + | - Delete the file when you're done. | ||