Inception成功安裝執行個體分享

來源:互聯網
上載者:User

Inception成功安裝執行個體分享

Inception是集審核SQL、執行SQL、復原於一體的一個自動化營運系統。

#ssh  192.168.163.128  //我的測試機

下載Inception

#mkdir -p /songlisha/inception

#cd /songlisha/inception

#wget https://github.com/mysql-inception/inception/archive/master.zip

安裝Inception

# unzip master.zip

# mkdir inception data //建inception的安裝目錄和資料目錄

#cd inception-master

# cmake -DWITH_DEBUG=OFF -DCMAKE_INSTALL_PREFIX=/songlisha/inception/inception  -DMYSQL_DATADIR=/songlisha/inception/data -DWITH_SSL=yes -DCMAKE_BUILD_TYPE=RELEASE -DWITH_ZLIB=bundled -DMY_MAINTAINER_CXX_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing  -Wno-unused-parameter -Woverloaded-virtual" -DMY_MAINTAINER_C_WARNINGS="-Wall -Wextra -Wunused -Wwrite-strings -Wno-strict-aliasing -Wdeclaration-after-statement"

編譯時間報錯啦!如所示:

解決辦法(安裝inception所需要的模組):

#yum -y install cmake  libncurses5-dev libssl-dev g++ bison openssl-devel.x86_64

#sh -x  inception_build.sh debug

# sh inception_build.sh debug [linux]

報錯如下:

解決辦法:

# make -j6 && make install

安裝完畢後添加設定檔:

#vim /songlisha/inception/inc.cnf

[inception]

general_log=1

general_log_file=/songlisha/inception/data/inception.log

port=6669

socket=/songlisha/inception/inc.socket

character-set-client-handshake=0

character-set-server=utf8

inception_remote_system_password=123456

inception_remote_system_user=root

inception_remote_backup_port=3306

inception_remote_backup_host=127.0.0.1

inception_support_charset=utf8mb4

inception_enable_nullable=0

inception_check_primary_key=1

inception_check_column_comment=1

inception_check_table_comment=1

inception_osc_min_table_size=1

inception_osc_bin_dir=/songlisha/inception/data/temp

inception_osc_chunk_time=0.1

inception_ddl_support=1

inception_enable_blob_type=1

inception_check_column_default_value=1

 

# mkdir -p /songlisha/inception/data/temp //建立設定檔中沒有的目錄

 

啟動Inception.

現在就到啟動時間了,那麼啟動有兩種方式,和MySQL是一樣的

1.設定檔啟動。

#/songlisha/inception/inception/bin/Inception --defaults-file=/songlisha/inception/inc.cnf

2. 連接埠啟動。

#/songlisha/inception/inception/bin/Inception --port=6669

我使用第一種方式啟動成功。

測試Inception

# mysql -uroot -h127.0.0.1 -P6669

mysql> inception get variables;    //列出所有參數,啟動成功!

安裝pip //pip類似RedHat裡面的yum,安裝Python包非常方便。

# cd /songlisha/inception

# wget "https://pypi.python.org/packages/source/p/pip/pip-1.5.4.tar.gz#md5=834b2904f92d46aaa333267fb1c922bb" --no-check-certificate

#tar zxvf pip-1.5.4.tar.gz

#cd pip-1.5.4

#python setup.py install

先安裝相依模組

#pip install flask_wtf

#pip install flask-script

#pip install flask-debugtoolbar

#pip install MySQL-python 

報錯如下:

error: command 'gcc' failed with exit status 1

Cleaning up...

Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/MySQL-python/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-lhP9WW-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/MySQL-python

Traceback (most recent call last):

  File "/usr/bin/pip", line 9, in <module>

    load_entry_point('pip==1.5.4', 'console_scripts', 'pip')()

  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/__init__.py", line 185, in main

    return command.main(cmd_args)

  File "/usr/lib/python2.6/site-packages/pip-1.5.4-py2.6.egg/pip/basecommand.py", line 161, in main

    text = '\n'.join(complete_log)

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 33: ordinal not in range(128)

解決辦法:

# yum install gcc libffi-devel python-devel openssl-devel -y

#pip install MySQL-python  //再次執行安裝成功!

安裝git

# yum -y install git

安裝inception_web

# git clone https://github.com/dbalihui/inception_web.git

#cd  /songlisha/inception/inception_web/app

# cat inception.py  //修改設定檔中的使用者名稱密碼

#coding=utf-8

import MySQLdb 

 

def table_structure(mysql_structure):

    sql1='/*--user=root;--password=root;--host=127.0.0.1;--execute=1;--port=3306;*/\

            inception_magic_start;\

            use songlisha;'    //這裡改成自己的資料庫名字

    sql2='inception_magic_commit;'

    sql = sql1 + mysql_structure + sql2

    try:

        conn=MySQLdb.connect(host='127.0.0.1',user='root',passwd='root',db='songlisha',port=6669,use_unicode=True, charset="utf8")

        cur=conn.cursor()

        ret=cur.execute(sql)

        result=cur.fetchall()

        num_fields = len(cur.description)

        field_names = [i[0] for i in cur.description]

        print field_names

        for row in result:

            print row[0], "|",row[1],"|",row[2],"|",row[3],"|",row[4],"|",row[5],"|",row[6],"|",row[7],"|",row[8],"|",row[9],"|",row[10]

        cur.close()

        conn.close()

    except MySQLdb.Error,e:

        print "Mysql Error %d: %s" % (e.args[0], e.args[1])

    return result[1][4].split("\n")


 

#cd  /songlisha/inception/inception_web/

# ./run.py runserver --host 127.0.0.1

報錯如下:

/songlisha/inception/inception_web/app/__init__.py:7: ExtDeprecationWarning: Importing flask.ext.script is deprecated, use flask_script instead.

  from flask.ext.script import Manager

Traceback (most recent call last):

  File "./run.py", line 7, in <module>

    from app import app,manager

  File "/songlisha/inception/inception_web/app/__init__.py", line 7, in <module>

    from flask.ext.script import Manager

  File "/usr/lib/python2.6/site-packages/flask/exthook.py", line 96, in load_module

    reraise(exc_type, exc_value, tb.tb_next)

  File "/usr/lib/python2.6/site-packages/flask_script/__init__.py", line 11, in <module>

    import argparse

ImportError: No module named argparse //缺少argparse 模組

解決辦法:

# easy_install argparse  //安裝該模組

再次

# ./run.py runserver --host 127.0.0.1

再次報錯:

ImportError: libmysqlclient.so.18: cannot open shared object file: No such file or directory

解決辦��:

# ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/libmysqlclient.so.18

# ./run.py runserver --host 127.0.0.1  //執行成功!但是無法從瀏覽器訪問到哦。

# ./run.py runserver --host 192.168.163.128 //必須得使用本機IP才能用瀏覽器訪問

在瀏覽器中訪問我的頁面

http://192.168.163.128:5000/

但是:# ./run.py runserver --host 192.168.163.128

此命令一退出,我的瀏覽器就不能訪問啦!404

screen -S server_ name 建立一個視窗管理器

ctrl + a + c 建立一個視窗

ctrl + a + n 切換到下一個視窗

ctrl + a + d 已最小化的視窗管理器

screen -dr server_name 重新開啟視窗管理器

screen -ls 列出視窗管理器列表

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.