Wisemapping REST API

只有幾個…
不知道哪邊才有詳細的API List … Orz

Ref. wisemapping-support › create and register a user via REST API

Obtaining user information by email:
* Template Path: /service/admin/users/email/{user.email}.json
* Example: curl "http://{host.name}:{host.port}/{context.path}/service/admin/users/email/{user.email}.json" --get --basic -u "admin@wisemapping.org:admin"

Deleting a based on the user id:
* Template Path: /service/admin/users/{userId}
* curl "http://{host.name}:{host.port}/{context.path}/service/admin/users/{userId}" --request delete --basic -u "admin@wisemapping.org:admin"

Changing Password:
Template Path: /service/admin/users/{userId}/password
* curl "http://{host.name}:{host.port}/{context.path}/service/admin/users/{userId}/password" --request put --basic -u "admin@wisemapping.org:admin" -H "Content-Type:text/plain" --data ""

Creating a new user:
* Template Path: /service/admin/users/
* Method: Post
* curl "http://{host.name}:{host.port}/{context.path}/service/admin/users" --request post --basic -u "admin@wisemapping.org:admin" -
H "Content-Type:text/json" --data "{email:"some email", lastname:"last name",fistname="my first name",password:"password"}"

Posted in Wisemapping | Leave a comment

[Wisemapping] find user by email in Python

#! /usr/bin/python
# coding:utf-8

# curl "http://localhost:8080/wisemapping/service/admin/users/email/{使用者帳號信箱}.json" --get --basic -u "admin@wisemapping.org:admin"

import sys
import urllib2
import base64
import yaml
import datetime

username = 'admin@wisemapping.org'
password = 'admin'

if len(sys.argv) == 2:
    request = urllib2.Request("http://localhost:8080/wisemapping/service/admin/users/email/%s.json" % sys.argv[1])
    base64string = base64.encodestring('%s:%s' % (username, password)).replace('n', '')
    request.add_header("Authorization", "Basic %s" % base64string)
    result = urllib2.urlopen(request).read()
    #print result
    print "ID:tt" + str(yaml.load(result).get('id'))
    print "Firstname:t" + yaml.load(result).get('firstname')
    print "Lastname:t" + yaml.load(result).get('lastname')
    print "E-Mail:tt" + yaml.load(result).get('email')
    print "Create Date:t" + datetime.datetime.fromtimestamp(yaml.load(result).get('creationDate') / 1000.0 ).strftime("%Y-%m-%d")
else:
    print "使用方法: python finduser.py {使用者email}"
Posted in Python, Wisemapping | Leave a comment

安裝Ubuntu在VMware環境出現 Host SMBus controller not enabled!

修改/etc/modprobe.d/blacklist.conf

vim /etc/modprobe.d/blacklist.conf
# 最後面加上
blacklist i2c-piix4
Posted in Ubuntu, VMware | Leave a comment

Ubuntu 關閉 ipv6

修改設定檔

sudo vim /etc/sysctl.conf
# 最後面加入下面
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1

直接套用

sudo sysctl -p
Posted in Ubuntu | Leave a comment

Wisemapping in Ubuntu 14.04 x64 server

Wisemapping

環境 : Ubuntu 14.04 x64 server

  1. 檢查系統是否已裝了 java development kit,如果是openjdk就先移除掉
java -version
  1. 安裝 Java Development Kit (版本>7)
sudo apt-get install software-properties-common python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
  1. 下載 wisemapping binary檔案
wget https://bitbucket.org/wisemapping/wisemapping-open-source/downloads/wisemapping-v3.0.4.zip
  1. 安裝 unzip
sudo apt-get install unzip
  1. 解壓縮 wisemapping 檔案
unzip wisemapping-v3.0.4.zip
  1. 切換到 wisemapping 目錄中
cd wisemapping-v3.0.4
  1. 測試執行
java -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar
# 看到 INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8080 代表正常啟動
# 可用瀏覽器觀看 http://ip:8080/wisemapping
  1. 安裝 mysql server、nginx
sudo apt-get install mysql-server nginx
  1. 編輯 wisemapping mysql 創建db的設定檔
vim config/database/mysql/create-database.sql
# 將password更改為要使用的密碼
SET PASSWORD FOR 'wisemapping'@'localhost' = PASSWORD('password');
  1. 匯入 wisemapping 資料庫
mysql -uroot -p < config/database/mysql/create-database.sql 
mysql -uwisemapping -Dwisemapping -p < config/database/mysql/create-schemas.sql
mysql -uwisemapping -Dwisemapping -p < config/database/mysql/apopulate-schemas.sql
  1. 修改 wisemapping 基本設定檔
vim webapps/wisemapping/WEB-INF/app.properties
# 將HSQL的部分註解
# HSQL Configuration properties
#database.url=jdbc:hsqldb:file:webapps/wisemapping/WEB-INF/database/wisemapping
#database.driver=org.hsqldb.jdbc.JDBCDriver
#database.hibernate.dialect=org.hibernate.dialect.HSQLDialect
#database.username=sa
#database.password=
#database.validation.enabled=false
#database.validation.query=

# 將mysql的設定反註解,並修改密碼
# MySQL 5.X configuration properties
database.url=jdbc:mysql://localhost/wisemapping?useUnicode=yes&characterEncoding=UTF-8
database.driver=com.mysql.jdbc.Driver
database.hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
database.username=wisemapping
database.password=password
database.validation.enabled=true
database.validation.query=SELECT 1

# 將Plain SMTP Server的部分註解
#------------------------
# Plain SMTP Server Configuration
#------------------------
#mail.smtp.port=25
#mail.smtp.host=localhost
#mail.username=root
#mail.password=
#mail.smtp.auth=false
#mail.smtp.starttls.enable=false
#mail.smtp.quitwait=false

# 使用google smtp,將其反註解,並填入設定值
#------------------------
# GMAIL SMTP Configuration
#------------------------
mail.smtp.port=587
mail.smtp.host=smtp.gmail.com
mail.username=cowman.chiang@gmail.com
mail.password=password
mail.smtp.auth=true
mail.smtp.starttls.enable=true
mail.smtp.quitwait=false

# 設定e-mail相關設定值
mail.serverSendEmail=cowman.chiang@gmail.com
mail.supportEmail=cowman.chiang@gmail.com
mail.errorReporterEmail=cowman.chiang@gmail.com

# 取消google reptcha功能
google.recaptcha.enabled = false

# 因為會使用到proxy,所以一定要設定site.baseurl
site.baseurl = http://10.201.121.16:8080/wisemapping
  1. 設定nginx proxy
sudo vim /etc/nginx/sites-available/default
# 幹掉全部~加入下面的部分
server {
    listen       80;
    access_log   /var/log/nginx/wisemapping.log;
    error_log    /var/log/nginx/wisemapping.log;
    location / {
        proxy_pass        http://localhost:8080/;
        proxy_set_header  Host $host;
        proxy_buffering   off;
    }
}
  1. 啟動服務
java -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar
# 因為設定過proxy,所以可用瀏覽器觀看 http://ip/wisemapping
  1. 管理,因為目前尚未提供web介面的管理,所以僅能使用curl方式從後台管理
sudo apt-get install curl
# 查詢使用者id
 curl "http://localhost:8080/wisemapping/service/admin/users/email/{使用者帳號信箱}.json" --get --basic -u "admin@wisemapping.org:admin"
# 取回json格式的資料
# {"password":null,"tags":[],"email":"cowman.chiang@gmail.com","firstname":"cowman","lastname":"chiang","creationDate":1415635200000,"id":5}
# 刪除使用者,由上面可以得知id為5
curl "http://localhost:8080/wisemapping/service/admin/users/{使用者ID}" --request delete --basic -u "admin@wisemapping.org:admin"
  1. 加入開機啟動
# 先修改start.sh
vim start.sh
# 修改為
#!/bin/sh

set -e
cd /home/tdg/wisemapping-v3.0.4
java -Xmx256m -Dorg.apache.jasper.compiler.disablejsr199=true -jar start.jar
# 修改rc.local
sudo vim /etc/rc.local
# 加入下面
/bin/sh /home/tdg/wisemapping-v3.0.4/start.sh
Posted in MySQL, Ubuntu, Wisemapping | Leave a comment

Etherpad-lite in Ubuntu 14.04 x64 server

etherpad

  1. 安裝基本套件需求
sudo apt-get install gzip git-core curl python libssl-dev pkg-config build-essential
  1. 更新安裝nodejs的來源
sudo curl -sL https://deb.nodesource.com/setup | sudo bash -
  1. 安裝nodejs
sudo apt-get install nodejs
  1. 新增etherpad的使用者
sudo useradd etherpad -m -s /bin/bash -r
sudo passwd etherpad
  1. 將etherpad使用者加入sudoers中
sudo usermod -a -G sudo etherpad
  1. 切換到etherpad使用者
su - etherpad
  1. 下載etherpad檔案
wget https://github.com/ether/etherpad-lite/zipball/master
  1. 安裝unzip
sudo apt-get install unzip
  1. 解壓縮etherpad壓縮檔
unzip master
  1. 將目錄名稱變好看一點
mv ether-etherpad-lite-3ebcaad etherpad-lite
  1. 切換到etherpad-lite目錄
cd etherpad-lite
  1. 複製設定檔範本
cp settings.json.template setting.json
  1. 設定etherpad基本環境
vim setting.json
# 找到以下的設定加以替換
   "requireSession" : false,
   "sessionNoPassword" : false,
   "requireAuthentication": false,
   "requireAuthorization": true,
   "users": {
      "admin": {
         "password": "password",
         "is_admin": true
      },
      "user": {
         "password": "password",
         "is_admin": false
      }
   },
  1. 試執行,可看 http://ip:9001 是否正常
./bin/run.sh
  1. 安裝mysql、nginx
sudo apt-get install mysql-server nginx
  1. 建立etherpad資料庫、設定使用者權限
mysql -uroot -p
> create database etherpad;
> grant all privileges on etherpad.* to 'etherpad'@'localhost' identified by 'password';
> exit
  1. 設定etherpad資料存放使用mysql
vim setting.json
   # 註解使用dirty的部分
   //"dbType" : "dirty",
   //"dbSettings" : {
   //                 "filename" : "var/dirty.db"
   //               },
   # 加入使用mysql的部分
   "dbType" : "mysql",
   "dbSettings" : {
                    "user"    : "etherpad",
                    "host"    : "localhost",
                    "password": "password",
                    "database": "etherpad"
                  },
  1. 試執行,並請連至 http://ip:9001 增加幾筆資料
./bin/run.sh
  1. 調整資料表屬性
mysql -uroot -p
> use etherpad;
> ALTER TABLE `store` CONVERT TO CHARACTER SET utf8 COLLATE utf8_bin;
> ALTER DATABASE `etherpad` CHARACTER SET utf8 COLLATE utf8_bin;
  1. 設定nginx proxy
sudo vim /etc/nginx/sites-enabled/default
# 全部內容不用留,以下面替換
server {
    listen       80;
    access_log   /var/log/nginx/etherpad.log;
    error_log    /var/log/nginx/etherpad.log;
    location / {
        proxy_pass        http://localhost:9001/;
        proxy_set_header  Host $host;
        proxy_buffering   off;
    }
}
  1. 設定etherpad信任proxy
vim setting.json
   # 找到以下的設定加以替換
   "trustProxy": true,
  1. 創建etherpad使用之log目錄
sudo mkdir /var/log/etherpad-lite
  1. 調整權限
sudo chown -R etherpad:etherpad /var/log/etherpad-lite
  1. 建立etherpad系統服務設定
sudo vim /etc/init/etherpad.conf
# 加入以下內容
description "etherpad"

start on started networking
stop on runlevel [!2345]

env EPHOME=/home/etherpad/etherpad-lite
env EPLOGS=/var/log/etherpad-lite
env EPUSER=etherpad

respawn

pre-start script
    cd $EPHOME
    mkdir $EPLOGS                              ||true
    chown $EPUSER:admin $EPLOGS                ||true
    chmod 0755 $EPLOGS                         ||true
    chown -R $EPUSER:admin $EPHOME/var         ||true
    $EPHOME/bin/installDeps.sh >> $EPLOGS/error.log || { stop; exit 1; }
end script

script
  cd $EPHOME/
  exec su -s /bin/sh -c 'exec "$0" "$@"' $EPUSER -- node node_modules/ep_etherpad-lite/node/server.js 
                        >> $EPLOGS/access.log 
                        2>> $EPLOGS/error.log
end script
  1. 以系統服務啟動etherpad
sudo start etherpad
  1. 重新讀取nginx設定
sudo service nginx reload
  1. 修改npm權限,避免/admin中無法安裝plugin
cd ~/etherpad-lite
sudo npm install -g express
chown -R etherpad ~/.npm
  1. 創建使用者管理用之資料表
mysql -uroot -p
> use etherpad;
> CREATE TABLE IF NOT EXISTS GroupPads ( GroupID int(11) NOT NULL, PadName varchar(255) COLLATE utf8_bin NOT NULL, PRIMARY KEY (GroupID, PadName) );
> CREATE TABLE IF NOT EXISTS User ( userID int(11) NOT NULL AUTO_INCREMENT, name varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '', pwd varchar(255) COLLATE utf8_bin DEFAULT NULL, considered tinyint(11) DEFAULT NULL, SSO tinyint(4) DEFAULT NULL, FullName varchar(255) COLLATE utf8_bin DEFAULT NULL, considerationString varchar(50) COLLATE utf8_bin DEFAULT NULL, salt varchar(255) COLLATE utf8_bin DEFAULT NULL, active int(1) DEFAULT NULL, PRIMARY KEY (userID,name) );
> CREATE TABLE IF NOT EXISTS NotRegisteredUsersGroups (  email varchar(255) NOT NULL,  groupID int(11) NOT NULL  );
> CREATE TABLE IF NOT EXISTS UserGroup ( userID int(11) NOT NULL DEFAULT 0, groupID int(11) NOT NULL DEFAULT 0, Role int(11) DEFAULT NULL, PRIMARY KEY (userID,groupID) );
> CREATE TABLE IF NOT EXISTS Groups (  groupID int(11) NOT NULL AUTO_INCREMENT,  name varchar(255) COLLATE utf8_bin NOT NULL DEFAULT '',  PRIMARY KEY (groupID, name )  );
> exit
  1. 安裝使用者管理套件
cd ~/etherpad-lite
npm install ep_user_pad
  1. 安裝使用者管理前端介面
cd ~/etherpad-lite
npm install ep_user_pad_frontend
  1. 修正email function,這邊改用gmail為例
sudo vim node_modules/ep_user_pad/email.json
    # 找到以下的設定加以替換
    "smtp": "true",
    "user": "cowman.chiang@gmail.com",
    "password": "password",
    "host": "smtp.gmail.com",
    "port": "465",
    "tls": "true",
    "ssl": "true",
  1. 修正email function,這邊改用gmail為例
sudo vim node_modules/ep_user_pad_frontend/email.json
    # 找到以下的設定加以替換
    "smtp": "true",
    "user": "cowman.chiang@gmail.com",
    "password": "password",
    "host": "smtp.gmail.com",
    "port": "465",
    "tls": "true",
    "ssl": "true",
  1. 修正hooks.js,不然會發生錯誤
sudo vim node_modules/ep_user_pad/hooks.js
# 註解下面這一行
//settings.encryptPassword = function (password, salt, cb) {
# 以下面這一行取代
var encryptPassword = function (password, salt, cb) {
  1. 安裝顯示作者名稱的功能
    cd ~/etherpad-lite
    npm install ep_authornames

  2. 建議安裝套件
    (1) adminpads : 在/admin中可以管理所有的筆記
    (2) authornames: 可以在筆記內容中顯示編輯的作者名稱
    (3) colors : 增加筆記的顏色功能
    (4) draw : 提供畫圖的功能
    (5) headings : 提供使用標題字型的功能
    (6) historicalsearch : 提供在筆記編輯歷史中搜尋的功能
    (7) padlist : 以/list顯示所有的筆記
    (8) user_pad : 提供使用者、群組及權限的管理方式
    (9) user_pad_forntend : user_pad的使用者介面

  3. 修正圖檔路徑問題

vim node_modules/ep_user_pad_frontend/templates/group.ejs 
vim node_modules/ep_user_pad_frontend/templates/public_pad.ejs
vim node_modules/ep_user_pad_frontend/templates/public_pad_logged_in.ejs
vim node_modules/ep_user_pad_frontend/templates/pad.ejs 
# 上述兩個檔案是修正下面這部分
img src="./static/plugins/ep_user_pad_frontend/static/images/pad-illustration-01.png" alt="Etherpad" 
# 修正為
img src="../static/plugins/ep_user_pad_frontend/static/images/pad-illustration-01.png" alt="Etherpad" 

pre lang=”bash”>vim node_modules/ep_user_pad_frontend/static/css/styles.less

上述這個檔案是修正下面這部分

.at2x(‘images/close-cyan-12.png’);

修正為

.at2x(‘../images/close-cyan-12.png’);

下面這句

list-style-image: url(images/users-cyan-16.png);

修正為

list-style-image: url(../images/users-cyan-16.png

  1. 設定 Log rotation
sudo vim /etc/logrotate.d/etherpad-lite
# 加入以下內容
/var/log/etherpad-lite/*.log
{
        rotate 4
        weekly
        missingok
        notifempty
        compress
        delaycompress
        sharedscripts
        postrotate
                restart etherpad-lite >/dev/null 2>&1 || true
        endscript
}
  1. 加入開機啟動
sudo vim /etc/rc.local
# 加入下面
/sbin/start etherpad start
Posted in etherpad, MySQL, Nagios, Ubuntu | Leave a comment

vimrc 常用設定值

" ts => 1個tab佔幾個空格
set ts=2
" sw => 每層縮進的空格數
set sw=2
" 註解顏色
hi Comment ctermfg =blue
" 字串顏色
hi String ctermfg =darkred
" 類型顏色
hi Type ctermfg =yellow
" 數字顏色
hi Number ctermfg =darkblue
" 常數顏色
hi Constant ctermfg =blue
" 聲明顏色
hi Statement ctermfg =darkyellow
Posted in Linux, Vim | Leave a comment

git push 失敗

當要push的時候發生了一點錯誤….

[tdg@udnlap01 mail]$ git push -u 20141028 master
Enter passphrase for key '/home/tdg/.ssh/id_rsa':
To git@cowman.no-ip.org:udn/udn_mail_log.git
 ! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@cowman.no-ip.org:udn/udn_mail_log.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again.  See the 'Note about
fast-forwards' section of 'git push --help' for details.

查看git status發現沒有問題

[tdg@udnlap01 mail]$ git status
# On branch master
nothing to commit (working directory clean)

執行rebase重新建立看看

[tdg@udnlap01 mail]$ git rebase 20141028
cannot rebase: you have unstaged changes
U       ftp.sh
M       ftp.sh

執行stash查看是什麼問題

[tdg@udnlap01 mail]$ git stash
ftp.sh: needs merge
ftp.sh: needs merge
ftp.sh: unmerged (7800202abc23a0e2d2702afd0e64f8ddec715bdf)
ftp.sh: unmerged (0e2f9d79c3e70028002bfa920d47c39b37ddbb9c)
fatal: git-write-tree: error building trees
Cannot save the current index state

選擇本低端的版本

[tdg@udnlap01 mail]$ git checkout --ours ftp.sh

後面就一般動作推上去了

[tdg@udnlap01 mail]$ git add ftp.sh
[tdg@udnlap01 mail]$ git commit -m "修正mailerd無動作、加入SSH&SCP "
[master 76eedce] 修正mailerd無動作、加入SSH&SCP
[tdg@udnlap01 mail]$ git push -u 20141028 master
Enter passphrase for key '/home/tdg/.ssh/id_rsa':
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.03 KiB, done.
Total 4 (delta 3), reused 0 (delta 0)
To git@cowman.no-ip.org:udn/udn_mail_log.git
   d5b4793..76eedce  master -> master
Branch master set up to track remote branch master from 20141028.
Posted in Git | Leave a comment

MySQL 單向備份

參考:
如何在 MySQL 5.5 設定單向資料庫複寫機制 (Replication)
Setting up MySQL replication without the downtime

  1. 定義
    Master => 被複製抄寫的伺服器
    Slave => 執行抄寫的伺服器

  2. 修改 Master 端的 mysql 設定
    vim /etc/my.cnf (或 vim /etc/ysql/my.cnf)

#在[mysqld]區段中加入
server-id=1
log-bin=mysql-bin
#需要同步的數據庫名
binlog-do-db= radius 
#避免同步的數據庫名
binlog-ignore-db= mysql 
  1. 重新啟動 mysql server
service mysqld reboot
  1. 檢查Master設定是否正常
mysql -uroot -p
mysql> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 | 11530633 | radius       |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.06 sec)
  1. 於Master創建抄寫用的使用者
mysql> CREATE USER '使用者'@'來源位置' IDENTIFIED BY '密碼';
  1. 於Master給予抄寫使用者權限 (錯誤版)
mysql> GRANT REPLICATION SLAVE ON radius.* TO '使用者'@'來源位置';
#==> ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
#因為無法單獨給予某個資料庫REPLICATION的權限, 所以會在master及slave的my.cnf中設定限制
#ex.
#   
#       server-id=1
#       log-bin=mysql-bin
#       binlog-do-db= radius #需要同步的數據庫名
#       binlog-ignore-db= mysql #避免同步的數據庫名
#   
#   
#       server-id=2
#       log-bin=mysql-bin
#       binlog-do-db= radius #需要同步的數據庫名

# 於Master給予抄寫使用者權限 (正確版)
mysql> GRANT REPLICATION SLAVE ON *.* TO '使用者'@'來源位置';
  1. 套用設定
mysql> FLUSH PRIVILEGES;
  1. Master匯出要同步的資料庫
mysqldump -u root -p --skip-lock-tables --single-transaction --master-data [選擇的資料庫名稱] > [輸出的檔名]
# 如果要輸出所有資料庫
# mysqldump -u root -p --skip-lock-tables --single-transaction --master-data --all-databases > [輸出的檔名]
  1. 傳送到抄寫伺服器
scp [輸出的檔名] [使用者]@[伺服器IP]:[存放位置]
  1. 於抄寫伺服器匯入資料庫
mysql -u root -p [指定的資料庫名稱] --default-character-set=utf8 < [輸出的檔名]
# 如果是之前是匯出所有資料庫,這邊就倒入所有資料庫
# mysql -u root -p --default-character-set=utf8 < [輸出的檔名]
  1. 修改 Slave 端的 mysql 設定
vim /etc/my.cnf (或 vim /etc/ysql/my.cnf)
#在[mysqld]區段中加入
server-id=2
#需要同步的數據庫名
binlog-do-db= radius 
  1. 重新啟動 mysql server
service mysqld reboot
  1. 設定 Master 的登入資訊,並啟動slave
mysql -uroot -p
mysql> CHANGE MASTER TO MASTER_HOST='[Master IP]', MASTER_PORT=3306, MASTER_USER='[使用者]', MASTER_PASSWORD='[密碼]';
  1. 啟動slave抄寫
mysql> START SLAVE;
  1. 檢查Slave設定是否正常
mysql> SHOW SLAVE STATUS G;
*************************** 1. row ***************************
             Slave_IO_State: Waiting for master to send event
                Master_Host: 192.168.55.142
                Master_User: repluser
                Master_Port: 3306
              Connect_Retry: 60
            Master_Log_File: mysql-bin.000005
        Read_Master_Log_Pos: 2381281
             Relay_Log_File: mysqld-relay-bin.000011
              Relay_Log_Pos: 31802
      Relay_Master_Log_File: mysql-bin.000005
           Slave_IO_Running: Yes
          Slave_SQL_Running: Yes
            Replicate_Do_DB:
        Replicate_Ignore_DB:
         Replicate_Do_Table:
     Replicate_Ignore_Table:
    Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
                 Last_Errno: 0
                 Last_Error:
               Skip_Counter: 0
        Exec_Master_Log_Pos: 2381281
            Relay_Log_Space: 31802
            Until_Condition: None
             Until_Log_File:
              Until_Log_Pos: 0
         Master_SSL_Allowed: No
         Master_SSL_CA_File:
         Master_SSL_CA_Path:
            Master_SSL_Cert:
          Master_SSL_Cipher:
             Master_SSL_Key:
      Seconds_Behind_Master: 0
1 row in set (0.00 sec)
  1. 如果發生錯誤
    查看上面出現的Last_Errno: [編號]
mysql> stop slave; SET GLOBAL sql_slave_skip_counter=[編號]; start slave;
Posted in MySQL | Leave a comment

GitLab – Requirements

Source :

Hardware requirements

CPU

1 core works supports up to 100 users but the application can be a bit slower due to having all workers and background jobs running on the same core
2 cores is the recommended number of cores and supports up to 500 users
4 cores supports up to 2,000 users
8 cores supports up to 5,000 users
16 cores supports up to 10,000 users
32 cores supports up to 20,000 users
64 cores supports up to 40,000 users
Memory

512MB is the absolute minimum but we do not recommend this amount of memory. You will either need to configure 512MB or 1.5GB of swap space. With 512MB of swap space you must configure only one unicorn worker. With one unicorn worker only git over ssh access will work because the git over http access requires two running workers (one worker to receive the user request and one worker for the authorization check). If you use SSD storage and configure 1.5GB of swap space you can use two Unicorn workers, this will allow http access but it will still be slow.
1GB RAM + 1GB swap supports up to 100 users
2GB RAM is the recommended memory size and supports up to 500 users
4GB RAM supports up to 2,000 users
8GB RAM supports up to 5,000 users
16GB RAM supports up to 10,000 users
32GB RAM supports up to 20,000 users
64GB RAM supports up to 40,000 users

Posted in Git | Leave a comment