elasticsearch linux 常用命令
新建索引
curl -XPUT ‘http://localhost:9200/dept/employee/1’ -d ‘{ “empname”: “emp1”}’
删除数据
curl -XDELETE ‘http://localhost:9200/dept/employee/3’
其实我一直在你身边
新建索引
curl -XPUT ‘http://localhost:9200/dept/employee/1’ -d ‘{ “empname”: “emp1”}’
删除数据
curl -XDELETE ‘http://localhost:9200/dept/employee/3’
IK Analysis for ElasticSearch
The IK Analysis plugin integrates Lucene IK analyzer (http://code.google.com/p/ik-analyzer/) into elasticsearch, support customized dictionary.
Analyzer: ik_smart , ik_max_word , Tokenizer: ik_smart , ik_max_word
$client = Elasticsearch\ClientBuilder::create()
# ->setHosts([“localhost:9200”])
->setHosts([“101.37.85.163:9200”])
->setRetries(1)
->build();
namespace searchapi\controllers;
use Yii;
use yii\web\Controller;
use searchapi\models\CarBrandInfo;
use searchapi\models\CarBrandType;
use searchapi\models\CarBrandTypeInfo;
use searchapi\models\CarBrandSonTypeInfo;
use searchapi\models\CarFactory;
use yii\data\Pagination;
use yii\helpers\BaseJson;
use Elasticsearch;
elasticsearch + logstash + kibana 强大的日志处理分析系统
一、设计流程:
1.数据导入redis队列 key=logstash
2.logstash 获取redis队列logstash里面的数据
3.logstash把收集到数据传入elasticsearch 里面的index = sitelogs
4.kibana 设置 index = sitelogs
5.打开kibana 查询日志
在wp-config.php 最后一行添加
define(‘FS_METHOD’, “direct”);
一般ssh服务的默认端口为22端口,查看监听的端口用netstat
GRANT ALL PRIVILEGES ON *.* TO ‘username’@’%’ IDENTIFIED BY ‘password’ WITH GRANT OPTION; 所有数据库所有表
GRANT ALL PRIVILEGES ON xinchuanbo.* TO ‘zzs’@’%’ IDENTIFIED BY ‘123456’ WITH GRANT OPTION; 开通用户:zzs 密码:123456 数据库 xinchuanbo (远程操作)
一、用www 权限下clone git 代码(因为nginx 那边php 解释执行是www用户)
二、www用户添加root免密码
1.使用 “su –” 命令,进入root用户;
2.为sudoers文件添加写入的权限:使用命令 “chmod u+w /etc/sudoers”
3.执行visudo 命令,按“i”进入编辑模式后,找到“root ALL=(ALL) ALL ”,在后面添加:”www ALL=(ALL) NOPASSWD: ALL”,再按一下“Esc”键退出编辑,输入“wq”(write quit)后,退出sudoers。
4.输入“chmod u-w /etc/sudoers”将文件的写入属性去掉
5.通过“exit”切换回自己的用户,再使用sudo whoami命令时,如果返回root,就可以使用了
static public function sinaShortUrl($url) {
$source = ‘118999789’;
$apiUrl = “http://api.t.sina.com.cn/short_url/shorten.json?source=$source&url_long=”.$url;
$result = json_decode(self::getCurl($apiUrl),true);
$shortUrl = $url;
if(!empty($result) && $result[0][‘type’] == 0 && $result[0][‘url_short’]){
$shortUrl = $result[0][‘url_short’];
}
return $shortUrl;
}