随笔分类 -  python

摘要:1. 下载# 我下载到了 /tmp 目录中cd /tmpwget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz2. 安装依赖yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel g... 阅读全文
posted @ 2019-06-28 10:11 remainsu 阅读(191) 评论(0) 推荐(0)
摘要:#!/usr/bin/env python#coding=utf8'''用于多机器间相互跳转,如有新机器加入,需要更新ip_list文件'''from prettytable import PrettyTablefrom sh import catimport osimport reclass GO(): def __init__(self): self.base_path =... 阅读全文
posted @ 2019-06-21 10:08 remainsu 阅读(486) 评论(0) 推荐(0)
摘要:1. 建立连接from elasticsearch import Elasticsearches = Elasticsearch(["localhost:9200"])2. 查询所有数据# 方式1:es.search(index="index_name", doc_type="type_name") # 方式2:body = { "query":{ "match_all":{}... 阅读全文
posted @ 2019-06-20 23:25 remainsu 阅读(20514) 评论(1) 推荐(1)
摘要:使用python连接es并执行最基本的查询from elasticsearch import Elasticsearches = Elasticsearch(["localhost:9200"])para = {"_source":"message"}es.search(index=index_name, q='offset: xx', doc_type='doc' ,params=para, s... 阅读全文
posted @ 2019-06-20 23:24 remainsu 阅读(874) 评论(2) 推荐(0)
摘要:import datetimeimport sysimport getoptimport hashlibfrom elasticsearch import Elasticsearch"""初始化elasticsearch连接"""def init_es(): return Elasticsearch(["localhost:9200"])"""查询数据, 支持分页"""def query_d... 阅读全文
posted @ 2019-06-20 23:24 remainsu 阅读(235) 评论(0) 推荐(0)