PJT
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Cuju Install Guide ## The environment prepare --- ### All Node Install * Assume you have already builded Primary, Backup and NFS node. *A recommended topology below:* ![](https://i.imgur.com/DuKZweZ.png) * If you only have one or two machine, you can reference this setting. *Another recommended topology below:* ![](https://i.imgur.com/38d0kzJ.png) - Open the Intel virtualization support (VT-x) in your bios. - Install OS in all nodes: [Ubuntu-16.04-desktop-amd64.iso (Ubuntu 16.04.0)](https://drive.google.com/file/d/0B9au9R9FzSWKUjRZclBXbXB0eEk/view) - Install related packages in all nodes ``` $ sudo apt-get update $ sudo apt-get install ssh vim gcc make gdb fakeroot build-essential \ kernel-package libncurses5 libncurses5-dev zlib1g-dev \ libglib2.0-dev qemu xorg bridge-utils openvpn vncviewer \ libssl-dev libpixman-1-dev nfs-common git ``` - Set up the bridge and network environment - You can follow our recommended topology to set up the network environment - The example of network interfaces set up below (edit your `/etc/network/interfaces`): - NFS node ``` auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.11.1 netmask 255.255.255.0 gateway 192.168.11.254 dns-nameservers 8.8.8.8 ``` eth0 is your physical NIC name, please modify it according to your actual NIC name - Primary node ``` auto lo iface lo inet loopback auto br0 iface br0 inet static bridge_ports eth0 bridge_maxwait 0 address 192.168.11.2 netmask 255.255.255.0 gateway 192.168.11.254 dns-nameservers 8.8.8.8 auto eth0 iface eth0 inet static address 0.0.0.0 auto eth1 iface eth1 inet static address 192.168.111.1 netmask 255.255.255.0 ``` - Backup node ``` auto lo iface lo inet loopback auto br0 iface br0 inet static bridge_ports eth0 bridge_maxwait 0 address 192.168.11.3 netmask 255.255.255.0 gateway 192.168.11.254 dns-nameservers 8.8.8.8 auto eth0 iface eth0 inet static address 0.0.0.0 auto eth1 iface eth1 inet static address 192.168.111.2 netmask 255.255.255.0 ``` - Build the high-speed connections (ex. 10G NIC) with Primary and Backup nodes by the `eth1` - After editing these network interfaces, type `/etc/init.d/networking restart` or `reboot` ### NFS Node Setup - Install the NFS service (Network FileSystem) in NFS node; then create a NFS folder placing the VM image ``` $ sudo apt-get install nfs-kernel-server ``` - Insert this line in `/etc/exports` to add your NFS folder: ``` /home/[your username]/nfsfolder *(rw,no_root_squash,no_subtree_check) ``` - After editing `/etc/exports`, type `/etc/init.d/nfs-kernel-server restart` or `reboot` - Go to your nfs folder, then download [Cuju](https://github.com/Cuju-ft/Cuju) and build a VM image file (or download our [Ubuntu-16.04 VM image](https://drive.google.com/file/d/0B9au9R9FzSWKNjZpWUNlNDZLcEU/view?usp=sharing) file, the `account/password` is `root/root`), they will be synced with Primary and Backup node. Download command ``` $ git clone https://github.com/Cuju-ft/Cuju $ wget -nc https://raw.githubusercontent.com/circulosmeos/gdown.pl/master/gdown.pl $ chmod +x gdown.pl $ ./gdown.pl https://drive.google.com/file/d/0B9au9R9FzSWKNjZpWUNlNDZLcEU/view Ubuntu20G-1604.tar.gz ``` Google drive download reference: [gdown.pl](https://github.com/circulosmeos/gdown.pl) ### Primary and Backup Node Setup - Mount the NFS folder ``` $ sudo mkdir /mnt/nfs $ sudo mount -t nfs 192.168.11.1:/home/[your username]/nfsfolder /mnt/nfs ``` ## Build Cuju --- * Clone Cuju on your NFS folder from Github ``` $ cd /mnt/nfs $ git clone https://github.com/Cuju-ft/Cuju.git ``` * Configure & Compile Cuju-ft ``` $ cd Cuju $ ./configure --enable-cuju --enable-kvm --disable-pie --target-list=x86_64-softmmu $ make -j8 ``` * Configure, Compile & insmod Cuju-kvm module `*1` `*2` ``` $ cd Cuju/kvm $ ./configure $ make -j8 $ ./reinsmodkvm.sh ``` >`*1` If you meet `error: incompatible type for argument 5 of '__get_user_pages_unlocked'`, you can use this patch: >``` >$ cd Cuju >$ patch -p1 < ./patch/__get_user_pages_unlocked.patch >``` > >`*2` If you meet `error: implicit declaration of function 'use_eager_fpu' [-werror=implicit-function-declaration]`, you can use this patch: >``` >$ cd Cuju >$ patch -p1 < ./patch/use_eager_fpu.patch >``` Execute Cuju ------- * Before launching your VM, you should update kvm module in Primary and Backup nodes: ``` $ cd /mnt/nfs/Cuju/kvm $ ./reinsmodkvm.sh ``` * Boot VM (on Primary Host) * ```runvm.sh``` ``` sudo ./x86_64-softmmu/qemu-system-x86_64 \ -drive if=none,id=drive0,cache=none,format=raw,file=/mnt/nfs/Ubuntu20G-1604.img \ -device virtio-blk,drive=drive0 \ -m 1G -enable-kvm \ -net tap,ifname=tap0 -net nic,model=virtio,vlan=0,macaddr=ae:ae:00:00:00:25 \ -cpu host \ -vga std -chardev socket,id=mon,path=/home/[your username]/vm1.monitor,server,nowait -mon chardev=mon,id=monitor,mode=readline ``` You need to change the guest image path (`file=/mnt/nfs/Ubuntu20G-1604.img`) and monitor path (`path=/home/[your username]/vm1.monitor`) for your environment * Use VNC to see the console ``` $ vncviewer :5900 & ``` The default `account/password` is `root/root` if you use we provide guest image * Start Receiver (on Backup Host) * ```recv.sh``` ``` sudo x86_64-softmmu/qemu-system-x86_64 \ -drive if=none,id=drive0,cache=none,format=raw,file=/mnt/nfs/Ubuntu20G-1604.img \ -device virtio-blk,drive=drive0 \ -m 1G -enable-kvm \ -net tap,ifname=tap1 -net nic,model=virtio,vlan=0,macaddr=ae:ae:00:00:00:25 \ -vga std -chardev socket,id=mon,path=/home/[your username]/vm1r.monitor,server,nowait -mon chardev=mon,id=monitor,mode=readline \ -cpu host \ -incoming tcp:0:4441,ft_mode ``` * You need to follow Boot VM script to change the related parameter or you can use following script to replace Receiver start script (if your VM start script is runvm.sh) * ```recv.sh``` ``` sed -e 's/mode=readline/mode=readline -incoming tcp\:0\:4441,ft_mode/g' -e 's/vm1.monitor/vm1r.monitor/g' -e 's/tap0/tap1/g' ./runvm.sh > tmp.sh chmod +x ./tmp.sh ./tmp.sh ``` * After VM boot and Receiver ready, you can execute following script to enter FT mode * ```ftmode.sh``` ``` sudo echo "migrate_set_capability cuju-ft on" | sudo nc -U /home/[your username]/vm1.monitor sudo echo "migrate -c tcp:192.168.111.2:4441" | sudo nc -U /home/[your username]/vm1.monitor ``` You need to change the ip address and port (`tcp:192.168.111.2:4441`) for your environment, this is Backup Host's IP And change the monitor path (`/home/[your username]/vm1.monitor`) for your environment * If you successfully start Cuju, you will see the following message show on Primary side: ![](https://i.imgur.com/nUdwKkB.jpg) * If you want to test failover You can `kill` or `ctrl-c` VM on the Primary Host ![](https://i.imgur.com/JWIhtDz.png) * You will need new session with vncviewer: * If you have Primary Host and Backup Host, execute on Backup Host: <br>`$ vncviewer :5900 &` * If you only have Primary Host with two VM: <br>`$ vncviewer :5901 &`

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully