更新
This commit is contained in:
		
							
								
								
									
										43
									
								
								linux/curl模拟ftp命令.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								linux/curl模拟ftp命令.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
				
			|||||||
 | 
					# curl 访问fttp服务器
 | 
				
			||||||
 | 
					## 下载MU_DFP_20210701_1.txt.gz 到MU_DFP_20210831_1.txt.gz文件到本地
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-  dfp服务器
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``` bash
 | 
				
			||||||
 | 
					 curl ftp://10.111.9.99/MU_DFP_[20210701-20210831]_1.txt.gz   --user ftp1:Cua123456! --remote-name
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					- MKT服务器
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```bash
 | 
				
			||||||
 | 
					curl ftp://10.16.0.127/bigdata/mkt_flight_[20201001-20201031].zip --user kn_it_kn:KN_it_d1a2t3  --remote-name
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- ACCA服务器
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``` bash
 | 
				
			||||||
 | 
					 curl ftp://10.16.0.127/ --user kn_acca:kn_acca_2021@
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 查询ftp://10.111.9.99/ 服务器下根目录的文件列表
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					``` bash 
 | 
				
			||||||
 | 
					 curl ftp://10.111.9.99/ --user ftp1:Cua123456!
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# tar 分卷压缩和解压
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 压缩
 | 
				
			||||||
 | 
					- 分卷压缩文件夹,且切分为2G文件, 切分的文件名为dfp.tar.gz.aa,dfp.tar.gz.ab。。。。
 | 
				
			||||||
 | 
					``` bash
 | 
				
			||||||
 | 
					tar -czf - 文件夹 | split -b 2048m - dfp.tar.gz
 | 
				
			||||||
 | 
					tar -czf - 文件夹 | split -b 2048m -d
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## 解压
 | 
				
			||||||
 | 
					- 解压到当前目录
 | 
				
			||||||
 | 
					``` bash
 | 
				
			||||||
 | 
					cat 文件名.tar.gz* | tar -xzf -  #将各个分卷压缩包解压到当前目录
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					cat 文件名.tar.gz* > 文件名.tar.gz #将各个分卷压缩包合成为一个 文件名.tar.gz文件
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
@@ -1,8 +1,24 @@
 | 
				
			|||||||
 | 
					```shell
 | 
				
			||||||
 | 
					-A  method:设置认证方式,比如method的值可以是peer、ident、md5、trust等值
 | 
				
			||||||
 | 
					--auth-host=method:这个选项用来设置远程主机连接的认证方法
 | 
				
			||||||
 | 
					--auth-local=method:这个选项用来设置本地主机连接的认证方法
 | 
				
			||||||
 | 
					-E encoding:设置服务器端的编码方式
 | 
				
			||||||
 | 
					-U user   :设置服务器的超级用户
 | 
				
			||||||
 | 
					--pwfile=filename:设置超级用户的密码文件,从filename文件中的第一行读取,一般用于设置比较复杂的密码,或者用于自动化处理。
 | 
				
			||||||
 | 
					-W     :后面不带任何数值,表示在初始化时手动输入密码。
 | 
				
			||||||
 | 
					-D/--pgdata:这个用来设置存放PostgreSQL数据库文件和配置文件所在目录。
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```shell
 | 
				
			||||||
 | 
					#改密码
 | 
				
			||||||
 | 
					\password
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```sh
 | 
					```sh
 | 
				
			||||||
PGSETUP_INITDB_OPTIONS="-E UTF-8 -D  数据路径" /usr/edb/as12/bin/edb-as-12-setup initdb
 | 
					PGSETUP_INITDB_OPTIONS="-E UTF-8 -D  数据路径" /usr/edb/as12/bin/edb-as-12-setup initdb
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -483,44 +483,6 @@ psql -Uicctestedb -dicctestedb -h192.168.53.123 -f ~/
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
导出导出部分数据
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
COPY (select * from icc.tcn_stat 
 | 
					 | 
				
			||||||
where afferent_date  between to_date('20220701','yyyymmdd') and to_date('20220714','yyyymmdd') ) TO '/home/edbdata/test.csv' WITH csv;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
COPY (
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
select * from  icc.tcn_stat_sales_volume_total
 | 
					 | 
				
			||||||
where flight_date  between to_date('20220701','yyyymmdd') and to_date('20221231','yyyymmdd') 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
) TO '/home/edbdata/tcn_stat_sales_volume_total.csv' WITH csv;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
COPY tcn_stat_sales_volume_total FROM '/home/edbdata/tcn_stat_sales_volume_total.csv' WITH csv;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### psql 导入导出文件
 | 
					#### psql 导入导出文件
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -666,3 +628,56 @@ psql -Uicctestedb -dicctestedb -h192.168.53.123 -f ~/
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### 数据导出 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```shell
 | 
				
			||||||
 | 
					#导出 iccedb库 
 | 
				
			||||||
 | 
					# -O 不设置表归属,
 | 
				
			||||||
 | 
					# -F c 自定义压缩
 | 
				
			||||||
 | 
					# -v 显示详情
 | 
				
			||||||
 | 
					./pg_dump -Uenterprisedb -diccedb -h192.168.53.118 -O -v -F c -f ~/diccedb_202207_29.data.sql
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#导入数据
 | 
				
			||||||
 | 
					#-c 指定恢复过程中清空目标数据库中的现有表
 | 
				
			||||||
 | 
					#--strict-names 指定严格遵守输入文件中的名称规范
 | 
				
			||||||
 | 
					#~/icc_data_20220719_test.sql 指定要恢复的输入文件路径
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					./pg_restore -Uenterprisedb -dtest2 -h10.23.101.119 -F c  -c  -v --strict-names ~/icc_data_20220719_test.sql
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#### COPY 导出导出部分数据
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```sh
 | 
				
			||||||
 | 
					sudo su - enterprisedb
 | 
				
			||||||
 | 
					psql edb
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##### 导出
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```sql
 | 
				
			||||||
 | 
					COPY (select * from icc.tcn_stat 
 | 
				
			||||||
 | 
					where afferent_date  between to_date('20220701','yyyymmdd') and to_date('20220714','yyyymmdd') ) TO '/home/edbdata/test.csv' WITH csv;
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					##### 导入
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```sql
 | 
				
			||||||
 | 
					COPY tcn_stat_sales_volume_total FROM '/home/edbdata/tcn_stat_sales_volume_total.csv' WITH csv;
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user