range

If there were you, the world would be just right

ik分词器安装 声明:安装完成后需要重新启动elasticsearch,elasticsearch-head,kibana

1.在elasticsearch目录的plugins解压elasticsearch-analysis-ik-7.6.1.zip

mkdir /data/es/servers/elasticsearch-7.6.1/plugins/ik
cd /data/es/servers/elasticsearch-7.6.1/plugins/ik
cp /usr/local/elasticsearch-analysis-ik-7.6.1.zip ./
unzip elasticsearch-analysis-ik-7.6.1.zip
  1. elasticsearch-plugin list 可以通过这个命令来查看加载进来的插件

主要kibana版本需要跟es版本一致

1. 在/usr/local/解压kibana-7.6.1-linux-x86_64.tar.gz

tar -xvf kibana-7.6.1-linux-x86_64.tar.gz

2. 创建kibana用户

useradd kibana
passwd kibana
chown -R kibana /usr/local/kibana

3.添加所有ip可访问 vim /usr/local/kibana/config/kibana.yml

server.host: "0.0.0.0"

4. 进入cd /usr/local/kibana/bin目录启动

切换kibana用户
su kibana 
./kibana

<?php

$db = new ran_pdo("qx_yisdk_user",true); 

$tables = [
    "yisdk_user",
];

foreach ($tables as $tab) {
    $count_sql = 'select count(*) c from yisdk_user where last_login_time>=1602518400 and uuid!=MD5(concat("new_",CONCAT_WS("_",channel,pf_game_id,user_id)))'; 

    $row = $db->get_one($count_sql);
    // 需要执行的条数
    $count = !empty($row["c"]) ? $row["c"] : 0;

    // 每次执行的条数 1000
    $do_num = 100;

    // 需要执行的次数
    $dc = ceil($count/$do_num);

    if($dc) for ($i=0; $i < $dc; $i++) { 
        $p = $i * $do_num;
        $sql = "select uuid,MD5(concat('new_',CONCAT_WS('_',channel,pf_game_id,user_id))) as new_uuid from yisdk_user where last_login_time>=1602518400 and uuid!=MD5(concat('new_',CONCAT_WS('_',channel,pf_game_id,user_id))) limit {$p},{$do_num}";

        $data = $db->get_all($sql);

        $update_sql = "UPDATE {$tab} a JOIN  (";
        $k = 0;
        foreach ($data as $key => $val) {

                $k = 1;
                $update_sql .= " SELECT '{$val['uuid']}' as uuid,'{$val['new_uuid']}' AS new_uuid UNION";

        }

        $sql = rtrim($update_sql,"UNION"); 
        $sql .= ") b USING(uuid) SET a.uuid=b.new_uuid";
        echo $sql;die;
        if($k){
            $db->query($sql);
        }
        sleep(1);
    }
}

可生成泛域名ssl网站

https://freessl.cn/
1 选择多域名通配符
2 选择浏览器方式生成

证书过期时间检查demo

<?php
$g = stream_context_create ([
    "ssl" => ["capture_peer_cert" => true],
    'http' => [
          'method' => 'GET',
        'user_agent' => 'shouwang.io ssl detector',
        'timeout'=>10
    ]
]);
$r = fopen("https://range8.cn/", "rb", false, $g);
$cont = stream_context_get_params($r);
$cert = openssl_x509_parse($cont["options"]["ssl"]["peer_certificate"]);

if(empty($cert['validTo_time_t'])) {
    throw new \Exception("Can't get cert expire time");
}

$fortyEightHours = strtotime("+48 hours");
if($cert['validTo_time_t'] <= $fortyEightHours) {
    throw new \Exception("Cert will expire in 48 hours");
} else {
    echo "证书过期时间:", date("Y-m-d H:i:s", $cert['validTo_time_t']);
}

记录一个代码文件加密算法

function RandAbc($length = "")
{ // 返回随机字符串
    $str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
    return str_shuffle($str);
}

$filename = 'getuser.php'; //要加密的文件
$T_k1 = RandAbc(); //随机密匙1
$T_k2 = RandAbc(); //随机密匙2
$vstr = file_get_contents($filename);
$v1 = base64_encode($vstr);
$c = strtr($v1, $T_k1, $T_k2); //根据密匙替换对应字符。
$c = $T_k1 . $T_k2 . $c;
$q1 = "O00O0O";
$q2 = "O0O000";
$q3 = "O0OO00";
$q4 = "OO0O00";
$q5 = "OO0000";
$q6 = "O00OO0";
$s = '$' . $q6 . '=urldecode("%6E1%7A%62%2F%6D%615%5C%76%740%6928%2D%70%78%75%71%79%2A6%6C%72%6B%64%679%5F%65%68%63%73%77%6F4%2B%6637%6A");$' . $q1 . '=$' . $q6 . '{3}.$' . $q6 . '{6}.$' . $q6 . '{33}.$' . $q6 . '{30};$' . $q3 . '=$' . $q6 . '{33}.$' . $q6 . '{10}.$' . $q6 . '{24}.$' . $q6 . '{10}.$' . $q6 . '{24};$' . $q4 . '=$' . $q3 . '{0}.$' . $q6 . '{18}.$' . $q6 . '{3}.$' . $q3 . '{0}.$' . $q3 . '{1}.$' . $q6 . '{24};$' . $q5 . '=$' . $q6 . '{7}.$' . $q6 . '{13};$' . $q1 . '.=$' . $q6 . '{22}.$' . $q6 . '{36}.$' . $q6 . '{29}.$' . $q6 . '{26}.$' . $q6 . '{30}.$' . $q6 . '{32}.$' . $q6 . '{35}.$' . $q6 . '{26}.$' . $q6 . '{30};eval($' . $q1 . '("' . base64_encode('$' . $q2 . '="' . $c . '";eval(\'?>\'.$' . $q1 . '($' . $q3 . '($' . $q4 . '($' . $q2 . ',$' . $q5 . '*2),$' . $q4 . '($' . $q2 . ',$' . $q5 . ',$' . $q5 . '),$' . $q4 . '($' . $q2 . ',0,$' . $q5 . '))));') . '"));';

$s = '<?php ' . "\n" . $s . "\n" . ' ?>';

// 生成 加密后的PHP文件
$fpp1 = fopen('temp_' . $filename, 'w');
fwrite($fpp1, $s) or die('写文件错误');