2018-8-25未命名文件
2018-8-25未命名文件
新建模板小書匠type(None) 16:35:39
elasticSearch解決大數據量字段模糊查詢,建立數據索引庫,全文檢索方式查詢。
全文檢索:檢索文本中的每個詞與搜索項進行對此。
全文索引:采用分詞器,對文本每個詞進行切分,建立詞條,方便進行查找。
Lucene 就是一套 全文檢索編程API , 基於Lucene 對數據建立索引,進行查詢
現在企業開發中,更常用是的 solr 搜索服務器和 ElasticSearch 搜索服務器
1.索引對象: 存儲數據的表結構 ,任何搜索數據,存放在索引對象上
2.映射:數據如何存放到索引對象上,需要有一個映射配置, 數據類型、是否存儲、是否分詞
3.文檔: 一條數據記錄, 存在索引對象上
4.文檔類型: 一個索引對象 存放多種類型數據,數據用文檔類型進行標識
ElasticSearch有什麽優點呢?
1 分布式實時文件存儲,可將每一個字段存入索引,使其可以被檢索到。?
2 實時分析的分布式搜索引擎。?
分布式:索引分拆成多個分片,每個分片可有零個或多個副本。集群中的每個數據節點都可承載一個或多個分片,並且協調和處理各種操作;?
負載再平衡和路由在大多數情況下自動完成。?
3 可以擴展到上百臺服務器,處理PB級別的結構化或非結構化數據。也可以運行在單臺PC上(已測試)?
支持插件機制,分詞插件、同步插件、Hadoop插件、可視化插件等。
select * from students where name != "周傑倫";
select * from students where is_delete=0;
select * from students where id > 3 and gender = 0;
select * from student where name like "黃%";
select * from students where id between 3 and 8;
select * from students where height is null;
select * from students order by id desc;
select * from students where gender=1 order by id asc;
select * from students order by height desc, id asc;
select count(*) from students;
sel
select max(height) from students;
select sum(age) from students;
select avg(age) from students;
select sum(age) from students where gender = 1;
select avg(age) from students where gender = 1;
select sum(age)/count(*) from students;
select sum(age)/count(*) from students where gender = 1;
select gender from students group by gender;
select gender,group_concat(name) from students group by gender;
select gender,group_concat(name) from students group by gender;
select gender,avg(age) from students group by gender;
select gender,count(*) from students group by gender;
select gender,count() from students group by gender having count() > 2;
select gender,count(*) from students group by gender having gender = "男";
select gender,count(*) from students group by gender with rollup;
select gender,count(*),sum(age) from students group by gender with rollup;
select gender,group_concat(age) from students group by gender with rollup;
select * from students limit 0,4;
select * from students limit 2,2;
select * from students inner join classes on students.cls_id = classes.id;
select * from students inner join classes on students.cls_id = classes.id;
select * from students as s inner join classes as c on s.cls_id = c.id;
select * from students as s left join classes as c on s.cls_id = c.id;
select * from students as s right join classes c on s.cls_id = c.id;
select * from students order by id desc limt 0,2;
select * from students where age > (select avg(age) from students) ;
select * from students where age > (select avg(age) from students);
select * from classes where id in (select cls_id from students);
select * from students where (age,height) = (select max(age),max(height) from students);
select distinct gender from students;
select gender ,count(*) from students group by gender;
select gender,group_concat(name) from students group by gender;
select cls_id,group_concat(name) from students group by cls_id;
select * from students order by id desc;
select gender,count() from students group by gender having count() >2;
select gender,count(*) from students group by gender with rollup;
select * from students order by id desc limit 0,10;
select * from students inner join classes on students.cls_id = classes.id;
select students.name,classes.name from students inner join classes on students.cls_id = classes.id;
select students.name as a,classes.name as b from students inner join classes on students.cls_id = classes.id;
select * from students as s left join classes as c on s.cls_id = c.id;
select * from students as s right join classes as c on s.cls_id = c.id;
create table booktest_areainfo(
aid int primary key,
atitle varchar(20),
pid int
);
select count(*) from booktest_areainfo where pid is null;
select atitle from booktest_areainfo where pid is null;
select city.* from booktest_areainfo as city inner join booktest_areainfo as province on city.pid = province.aid where province.atitle="湖北省";
數據庫商品類表格的設計開發,
1,Django_Contab實現網站首頁靜態化頁面的定時更新;
2,Redis數據庫緩存高頻數據,加快網站的響應速度;
3,賬號(用戶名,電話號) + 密碼模式實現切換登錄,QQ,微信,微博等第三方登錄方式的引入,實現用戶多渠道登錄實現;
4,Celery搭配Admin站點類實現詳情頁面的後臺數據變動實時同步更新詳情靜態化頁面;
5,基於Cookie和Redis對傳統購物車的優化,未登錄用戶購物車數據暫存Cookies,登錄後同步數據到Redis中,提高用戶購物體驗;
6,訂單模塊的開發,Django中的Atomic來控制訂單模塊數據庫事務的執行,樂觀鎖防止高並發下的超賣現象;
7,Docker來部署FastDFS,重載Django原生的文件管理類,將FastDFS融入到項目中,實現海量文件的存儲;
8,sql數據庫雙機熱備,主從配置實現讀寫分離,提高數據庫性能;
9,Celery開啟進程訂閱redis數據過期信號,並相應的操作數據庫進行庫存的增加;
10,X-admin來搭建後臺站點管理,實現用戶權限管理;
2018-8-25未命名文件