root

Centos7.6搭建nginx 1.16.1并使用upstream_check_module模块

删除回忆录丶 提交于 2020-01-22 23:07:49
环境说明: 主机名 操作系统版本 ip nginx版本 httpd版本 备注 nginx Centos 7.6.1810 172.27.34.41 1.16.1 / nginx服务器 web01 Centos 7.6.1810 172.27.34.161 / 2.4.6 web服务器 web02 Centos 7.6.1810 172.27.34.162 / 2.4.6 web服务器 web03 Centos 7.6.1810 172.27.34.163 / 2.4.6 web服务器 一、nginx_upstream_check_module简介 1. 模块出处 由淘宝团队开发,淘宝自己的 tengine 上自带该模块。 2. 模块意义 nginx自带的针对后端节点健康检查的功能比较简单,无法主动识别后端节点状态,后端即使有不健康节点, 负载均衡器依然会把该请求转发给该不健康节点,只能等待超时时间后转发到其他节点,这样就会造成响应延迟性能降低的问题。 二、nginx安装 1. nginx下载 nginx版本查看: https://nginx.org/en/download.html 下载最新的稳定版本 nginx-1.16.1 源码包并解压 [root@nginx ~]# wget https://nginx.org/download/nginx-1.16.1.tar.gz

Morris遍历遍历二叉树

孤街浪徒 提交于 2020-01-22 22:51:29
遍历二叉树的递归方法使用了函数栈,非递归方法使用了申请的栈, 两者的额外空间都与树的高度有关,所以空间复杂度为O(h),h为二叉树的高度。 可以使用二叉树叶子节点中大量指向null的指针实现空间复杂度O(1)的遍历。 Morris遍历的实质就是避免使用栈结构,让下层到上层有指针, 具 体是通过让底层节点指向null的空闲指针指回上层的某个节点,从而完成下层到上层的移动。 先序中序后序主要基于两个主要步骤,然后输出的位置有所不同,以中序遍历为例。 中序遍历: 1、假设当前子树的头节点为h,让h的左子树中最右节点的right指针指向h, 然后h的左子树继续步骤1的处理过程,直到遇到某一个节点没有左子树时记为node,进入步骤2。 2、从node开始通过每个节点的right指针进行移动并以此打印,假设移动到的节点为cur。 对每一个cur节点都判断cur节点的左子树中最右节点是否指向cur。 Ⅰ 如果是,令cur节点的左子树中最右节点的right指针指向null,即恢复树的本来面貌, 然后打印cur,继续通过cur的right指针移动到下一个节点。重复步骤2。 Ⅱ 如果不是,以cur为头的子树重回步骤1执行。 public void morrisIn(TreeNode root) { if (root == null) return; TreeNode cur1 = root;

Python GUI tkinter编程之Spinbox篇

一笑奈何 提交于 2020-01-22 18:50:13
1.第一个Spinbox #-*-coding:utf-8-*- ''' 与Entry类似,但可以指定输入范围值 第一个Spinbox ''' from tkinter import * root = Tk() Spinbox(root).pack() root.mainloop() 2.创建Spinbox时指定参数 from:最小值 to:最大值 increment:步距值 #-*-coding:utf-8-*- ''' 创建Spinbox时指定参数 from:最小值 to:最大值 increment:步距值 ''' from tkinter import * root = Tk() Spinbox(root, from_ = 0, to = 100, increment = 5 #设置增量值为5,这个与Scale的resolution意思相同 ).pack() root.mainloop() 3.设置Spinbox的值 values:指定Spinbox序列值,设置此值后,每次更新值将使用values指定的值 #-*-coding:utf-8-*- ''' 设置Spinbox的值 values:指定Spinbox序列值,设置此值后,每次更新值将使用values指定的值 ''' from tkinter import * root = Tk() sb = Spinbox(root,

前端数据结构之二叉搜索树

和自甴很熟 提交于 2020-01-22 17:30:15
欢迎阁下光临我的github前端知识汇总 https://github.com/JimmyLLLL/js 如果您可以慷慨赠予我星星,在下不胜感激! 百度百科:二叉搜索树(Binary Search Tree),(又:二叉搜索树,二叉排序树)它或者是一棵空树,或者是具有下列性质的 二叉树 : 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值; 若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值; 它的左、右子树也分别为 二叉排序树 。 二叉搜索树个人解读:比它小放左边,比它大放右边 class Node{ constructor(value){ this.value = value this.left = null this.right = null } } //插入节点函数的辅助函数,用来递归,递归的内容对初学者来讲有点难,但是相信我,时间可以消磨一切,一遍又一遍,你可以看懂的!我也在此陪你,加油~ function insertNodeHelper(node,newNode){ if(node.value < newNode.value){ if(node.right===null){ node.right = newNode }else{ insertNodeHelper(node.right,newNode) } }else{ if(node.left=

pyspider + python2.7

青春壹個敷衍的年華 提交于 2020-01-22 16:44:52
升级pip pip install --upgrade pip pip安装pyspider pip install pyspider 安装phantomjs: https://phantomjs.org/download.html wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 yum -y install bzip2 tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /opt/ mv phantomjs-2.1.1-linux-x86_64/ phantomjs 建立软链接 ln -s /opt/phantomjs/bin/phantomjs /usr/bin/ 安装依赖 yum -y install fontconfig 启动验证 phantomjs pyspider启动报错 ValueError: Invalid configuration: - Deprecated option 'domaincontroller': use 'http_authenticator.domain_controller' instead. 在安装包中找到pyspider的资源包

How to execute a shell command with root permission from swift

旧城冷巷雨未停 提交于 2020-01-22 15:27:17
问题 I am new on Swift and I am trying to create a very simple application that executes a root shell command when you press a round button. I have found the following link online, that explains how to execute a shell command with user permission on swift, but it doesn't tell how to do it with root privileges: http://practicalswift.com/2014/06/25/how-to-execute-shell-commands-from-swift/ How can I do it? 回答1: Quick-and-dirty: NSAppleScript(source: "do shell script \"sudo whatever\" with

centos7.6下pyspider + python2.7安装

故事扮演 提交于 2020-01-22 15:23:46
1.升级pip pip install --upgrade pip 2.pip安装pyspider pip install pyspider 3.安装phantomjs: https://phantomjs.org/download.html wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 yum -y install bzip2 tar -jxvf phantomjs-2.1.1-linux-x86_64.tar.bz2 -C /opt/ mv phantomjs-2.1.1-linux-x86_64/ phantomjs 建立软链接 ln -s /opt/phantomjs/bin/phantomjs /usr/bin/ 安装依赖 yum -y install fontconfig 启动验证 phantomjs 4.pyspider启动报错 ValueError: Invalid configuration: - Deprecated option 'domaincontroller': use 'http_authenticator.domain_controller' instead. 在安装包中找到pyspider的资源包

docker安装mysql

拜拜、爱过 提交于 2020-01-22 12:08:52
一、拉取镜像 docker pull mysql:5.7 二、创建mysql本地映射目录 #做映射关系是为了防止docker镜像意外被删除而导致数据丢失 mkdir -p /root/mysql/data /root/mysql/logs /root/mysql/conf 三、启动镜像 docker run -p 3306:3306 --name mysql -v /root/mysql/conf:/etc/mysql/conf.d -v /root/mysql/logs:/logs -v /root/mysql/data:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=root -d mysql:5.7 -d: 后台运行容器 -p 将容器的端口映射到本机的端口 -v 将主机目录挂载到容器的目录 -e 设置参数 四、连接测试 Navicat 测试连接 来源: https://www.cnblogs.com/angelyan/p/12228153.html

Check if a user is root in a java application

泄露秘密 提交于 2020-01-22 12:04:32
问题 How can i verify if a user is root in a java application? Thanks 回答1: Process p = Runtime.getRuntime().exec("id -u") Keep in mind that the "root" user on a system may not be called root (although it's rare to change it), and it's also possible to alias it to another username. If the current user is root-like, the output will be 0 . 回答2: Easy. Just use System.getProperty("user.name") 回答3: run a native command? like whoami 回答4: You can call Process p = Runtime.getRuntime.exec("whoami") method.

Check if a user is root in a java application

梦想与她 提交于 2020-01-22 12:04:24
问题 How can i verify if a user is root in a java application? Thanks 回答1: Process p = Runtime.getRuntime().exec("id -u") Keep in mind that the "root" user on a system may not be called root (although it's rare to change it), and it's also possible to alias it to another username. If the current user is root-like, the output will be 0 . 回答2: Easy. Just use System.getProperty("user.name") 回答3: run a native command? like whoami 回答4: You can call Process p = Runtime.getRuntime.exec("whoami") method.