|
7 | 7 | toc: true |
8 | 8 | --- |
9 | 9 |
|
10 | | - |
11 | | -## Ubuntu 16.04安装SQLLite3 |
12 | | - |
13 | | -```shell |
14 | | -jiangxin@db01:~$ sudo apt-get install sqlite3 |
15 | | -jiangxin@db01:~$ sqlite3 test.db |
16 | | -SQLite version 3.11.0 2016-02-15 17:29:24 |
17 | | -Enter ".help" for usage hints. |
18 | | -sqlite> create table mytable(id integer primary key, value text); |
19 | | -sqlite> insert into mytable(id, value) values(1, 'Micheal'); |
20 | | -sqlite> select * from mytable; |
21 | | -1|Micheal |
22 | | -sqlite> .help |
23 | | -.backup ?DB? FILE Backup DB (default "main") to FILE |
24 | | -.bail on|off Stop after hitting an error. Default OFF |
25 | | -.binary on|off Turn binary output on or off. Default OFF |
26 | | -.changes on|off Show number of rows changed by SQL |
27 | | -.clone NEWDB Clone data into NEWDB from the existing database |
28 | | -.databases List names and files of attached databases |
29 | | -.dbinfo ?DB? Show status information about the database |
30 | | -.dump ?TABLE? ... Dump the database in an SQL text format |
31 | | - If TABLE specified, only dump tables matching |
32 | | - LIKE pattern TABLE. |
33 | | -.echo on|off Turn command echo on or off |
34 | | -.eqp on|off Enable or disable automatic EXPLAIN QUERY PLAN |
35 | | -.exit Exit this program |
36 | | -.explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic |
37 | | -.fullschema Show schema and the content of sqlite_stat tables |
38 | | -.headers on|off Turn display of headers on or off |
39 | | -.help Show this message |
40 | | -.import FILE TABLE Import data from FILE into TABLE |
41 | | -.indexes ?TABLE? Show names of all indexes |
42 | | - If TABLE specified, only show indexes for tables |
43 | | - matching LIKE pattern TABLE. |
44 | | -.limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT |
45 | | -.load FILE ?ENTRY? Load an extension library |
46 | | -.log FILE|off Turn logging on or off. FILE can be stderr/stdout |
47 | | -.mode MODE ?TABLE? Set output mode where MODE is one of: |
48 | | - ascii Columns/rows delimited by 0x1F and 0x1E |
49 | | - csv Comma-separated values |
50 | | - column Left-aligned columns. (See .width) |
51 | | - html HTML <table> code |
52 | | - insert SQL insert statements for TABLE |
53 | | - line One value per line |
54 | | - list Values delimited by .separator strings |
55 | | - tabs Tab-separated values |
56 | | - tcl TCL list elements |
57 | | -.nullvalue STRING Use STRING in place of NULL values |
58 | | -.once FILENAME Output for the next SQL command only to FILENAME |
59 | | -.open ?FILENAME? Close existing database and reopen FILENAME |
60 | | -.output ?FILENAME? Send output to FILENAME or stdout |
61 | | -.print STRING... Print literal STRING |
62 | | -.prompt MAIN CONTINUE Replace the standard prompts |
63 | | -.quit Exit this program |
64 | | -.read FILENAME Execute SQL in FILENAME |
65 | | -.restore ?DB? FILE Restore content of DB (default "main") from FILE |
66 | | -.save FILE Write in-memory database into FILE |
67 | | -.scanstats on|off Turn sqlite3_stmt_scanstatus() metrics on or off |
68 | | -.schema ?TABLE? Show the CREATE statements |
69 | | - If TABLE specified, only show tables matching |
70 | | - LIKE pattern TABLE. |
71 | | -.separator COL ?ROW? Change the column separator and optionally the row |
72 | | - separator for both the output mode and .import |
73 | | -.shell CMD ARGS... Run CMD ARGS... in a system shell |
74 | | -.show Show the current values for various settings |
75 | | -.stats on|off Turn stats on or off |
76 | | -.system CMD ARGS... Run CMD ARGS... in a system shell |
77 | | -.tables ?TABLE? List names of tables |
78 | | - If TABLE specified, only list tables matching |
79 | | - LIKE pattern TABLE. |
80 | | -.timeout MS Try opening locked tables for MS milliseconds |
81 | | -.timer on|off Turn SQL timer on or off |
82 | | -.trace FILE|off Output each SQL statement as it is run |
83 | | -.vfsinfo ?AUX? Information about the top-level VFS |
84 | | -.vfslist List all available VFSes |
85 | | -.vfsname ?AUX? Print the name of the VFS stack |
86 | | -.width NUM1 NUM2 ... Set column widths for "column" mode |
87 | | - Negative values right-justify |
88 | | -sqlite> .quit |
89 | | -jiangxin@db01:~$\ |
90 | | -``` |
91 | | -
|
92 | | -由于Sqlite本身不支持远程访问,如果需要在Windows上连接远程Linux上的Sqlite,需要在Linux上共享文件给Windows。 |
93 | | -共享方式见: |
94 | | -Ubuntu创建共享文件夹并支持Windows访问:http://jingyan.baidu.com/article/2fb0ba40a8283500f2ec5f35.html |
95 | | -
|
96 | | -
|
97 | | -在Windows上打开资源浏览器,在输入框输入\\192.168.1.150 |
98 | | -然后输入用户名、密码即可 |
99 | | -
|
100 | | - |
101 | | -
|
102 | | -
|
103 | | - |
104 | | -
|
105 | | -将之前创建的test.db移到share/sqlite目录: |
106 | | -
|
107 | | -jiangxin@db01:~$ mv test.db share/sqlite/ |
108 | | -
|
109 | | -在Windows上用dbeaver连接Linux上的远程数据库 |
110 | | -
|
111 | | - |
112 | | -
|
113 | | -## 安装Prometheus |
114 | | -
|
115 | | -下载地址:<https://prometheus.io/download/> |
116 | | -
|
117 | | -```shell |
118 | | -jiangxin@ubuntu11:~$ sudo mkdir /usr/local/prometheus |
119 | | -jiangxin@ubuntu11:~$ sudo chown -R jiangxin:jiangxin /usr/local/prometheus |
120 | | -jiangxin@ubuntu11:~$ cd /usr/local/prometheus/ |
121 | | -jiangxin@ubuntu11:/usr/local/prometheus$ ls |
122 | | -prometheus-1.7.1.linux-amd64.tar.gz |
123 | | -jiangxin@ubuntu11:/usr/local/prometheus$ tar -zxvf prometheus-1.7.1.linux-amd64.tar.gz |
124 | | -jiangxin@ubuntu11:/usr/local/prometheus$ cd prometheus-1.7.1.linux-amd64/ |
125 | | -``` |
126 | | -
|
127 | | -修改:`/etc/profile` |
128 | | -
|
129 | | -```shell |
130 | | -export PROMETHEUS_HOME=/usr/local/prometheus/prometheus-1.7.1.linux-amd64 |
131 | | -export PATH=$PATH:$PROMETHEUS_HOME |
132 | | -``` |
133 | | -
|
134 | | -```shell |
135 | | -jiangxin@ubuntu11:/usr/local/prometheus/prometheus-1.7.1.linux-amd64$ source /etc/profile |
136 | | -jiangxin@ubuntu11:/usr/local/prometheus/prometheus-1.7.1.linux-amd64$ cd |
137 | | -``` |
138 | | -
|
139 | | -### 启动 |
140 | | -
|
141 | | -jiangxin@ubuntu11:~$ prometheus -config.file=${PROMETHEUS_HOME}/prometheus.yml |
142 | | -
|
143 | | -```log |
144 | | -INFO[0000] Starting prometheus (version=1.7.1, branch=master, revision=3afb3fffa3a29c3de865e1172fb740442e9d0133) source="main.go:88" |
145 | | -... |
146 | | -``` |
147 | | -
|
148 | | -### 查看界面 |
149 | | -http://192.168.1.130:9090/metrics |
150 | | -
|
151 | | - |
152 | | -
|
153 | | -http://192.168.1.130:9090/graph |
154 | | -
|
155 | | - |
156 | | -
|
157 | 10 | ## Windows 10系统下搭建Jenkins环境 |
158 | 11 |
|
159 | 12 | 主要参考: |
|
0 commit comments