首页 文章 精选 留言 我的

精选列表

搜索[设置],共10023篇文章
优秀的个人博客,低调大师

openstack学习笔记二 网络设置基础

租用这个服务的机构,我们称之"租户/tenant/项目/project" 租户 用户 vxlan划分租户 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [root@h1~] #ipaddr 1:lo:<LOOPBACK,UP,LOWER_UP>mtu65536qdiscnoqueuestateUNKNOWN link /loopback 00:00:00:00:00:00brd00:00:00:00:00:00 inet127.0.0.1 /8 scopehostlo valid_lftforeverpreferred_lftforever 2:eth0:<BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscmqstateUPqlen1000 link /ether 00:50:56:a0:b6:6bbrdff:ff:ff:ff:ff:ff inet192.168.1.201 /24 brd192.168.1.255scopeglobaleth0 valid_lftforeverpreferred_lftforever 3:ovs-system:<BROADCAST,MULTICAST>mtu1500qdiscnoopstateDOWN link /ether 36:26:25:65:14:9cbrdff:ff:ff:ff:ff:ff 4:br-ex:<BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscnoqueuestateUNKNOWN link /ether de:4c:6d:9c:15:4dbrdff:ff:ff:ff:ff:ff 5:br-int:<BROADCAST,MULTICAST>mtu1500qdiscnoopstateDOWN link /ether ce:0b:9b:b5:c1:4dbrdff:ff:ff:ff:ff:ff 6:br-tun:<BROADCAST,MULTICAST>mtu1500qdiscnoopstateDOWN link /ether ae:75:26:fb:f8:42brdff:ff:ff:ff:ff:ff 你想把哪个网络作为数据包的出口,那么你就应该把那个网卡桥接到 br-ex openvswitch 简称 ovs 配置网卡 重点 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 [root@h1network-scripts] #catifcfg-eth0 DEVICE=eth0 DEVICETYPE=ovs TYPE=OVSPort OVS_BRIDGE=br-ex ONBOOT= yes BOOTPROTO=none [root@h1network-scripts] #catifcfg-br-ex DEVICE=br-ex DEVICETYPE=ovs TYPE=OVSBridge ONBOOT= yes BOOTPROTO=none IPADDR=192.168.1.201 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 DNS1=202.106.0.20 1 2 3 4 5 6 7 8 9 10 查看网卡 2:eth0:<BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscmqmasterovs-systemstateUPqlen1000 link /ether 00:50:56:a0:b6:6bbrdff:ff:ff:ff:ff:ff 3:ovs-system:<BROADCAST,MULTICAST>mtu1500qdiscnoopstateDOWN link /ether d2:18:7d:5e:5e:b9brdff:ff:ff:ff:ff:ff 5:br-ex:<BROADCAST,MULTICAST,UP,LOWER_UP>mtu1500qdiscnoqueuestateUNKNOWN link /ether 00:50:56:a0:b6:6bbrdff:ff:ff:ff:ff:ff inet192.168.1.201 /24 brd192.168.1.255scopeglobalbr-ex valid_lftforeverpreferred_lftforever 管理员登陆http://192.168.1.201/dashboard 选择系统--网络--创建网络 创建,点击网络名称put-ex 下一步 创建一个项目,创建一个新的用户,新用户关联项目。 用新的用户登录,创建网络 先创建网络,然后创建路由,连到网络上,最后添加端口 本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/1795705,如需转载请自行联系原作者

优秀的个人博客,低调大师

Openstack 之 网络设置静态IP地址

Openstack网络分配都是动态分配,但是在实际使用当中更多的会用到静态IP,Ocata版本的web管理界面尚未提供完善的操作菜单界面,暂时只能通过命令行解决,其实也很简单,一条命令就解决了。下面是操作方法: 实例连接接口,系统会自动分配一个IP地址,比如192.168.170.153,修改成固定IP(192.168.170.181)方法如下: 1、openstack port list ,找出自动分配的IP和subnet; 2、然后执行下面这个命令进行修改,加--name参数顺便将端口名称修改: openstack port set --name cirros-1 --no-fixed-ip --fixed-ip ip-address='192.168.170.181',subnet='19b1397a-1150-495f-a423-fe0b104602d8' 7e475b34-7ae8-41dd-be10-7079f973926c 3、然后进入虚拟机,将相应的端口地址改为固定IP 192.168.170.181 本文转自yuweibing51CTO博客,原文链接:http://blog.51cto.com/yuweibing/2071351,如需转载请自行联系原作者

优秀的个人博客,低调大师

IPv6设置支持IOS审核

https://www.tunnelbroker.net/ 点击创建以后出现如下界面 检查服务器是否开启IPv6(表示没有开启)http://www.jianshu.com/p/2f6620e5a4f0 vim /etc/sysctl.conf #添加如下三行 sysctl -p net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0 vim /etc/modprobe.d/disable_ipv6.conf #options ipv6 disable=1改为options ipv6 disable=0 alias net-pf-10 off options ipv6 disable=0 vim /etc/sysconfig/network 添加 NETWORKING_IPV6=yes 重启网络systemctl restart network 可以看出已经支持IPv6 服务器执行如下命令上面获取的: modprobe ipv6 ip tunnel add he-ipv6 mode sit remote 216.218.221.6 local 39.107.13.70 ttl 255 ip link set he-ipv6 up ip addr add 2001:470:18:107b::2/64 dev he-ipv6 ip route add ::/0 dev he-ipv6 ip -f inet6 addr DNS控制台解析 测试可以看出已经解析 然后在这台服务器上面大家nginx支持IPv6代理即可 user nginx; worker_processes auto; error_log /var/log/nginx/error.log; pid /run/nginx.pid; include /usr/share/nginx/modules/.conf; events { worker_connections 1024; } http { log_format main '$remote_addr - $remote_user [$time_local] "$http_host" "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" $http_x_forwarded_for ' '"$upstream_addr" "$upstream_status" "$upstream_response_time" "$request_time"'; access_log /etc/nginx/logs/access.log main; sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; include /etc/nginx/conf.d/.conf; } stream { upstream tcp_proxy { hash $remote_addr consistent; #远程地址做个hash server slbIP:80; } upstream tcp_proxy_443 { hash $remote_addr consistent; #远程地址做个hash server slbIP:443; } server { listen [::]:80; listen 80; proxy_connect_timeout 1s; proxy_timeout 10s; #后端连接超时时间 proxy_pass tcp_proxy; } server { listen [::]:443; listen 443; proxy_connect_timeout 1s; proxy_timeout 10s; #后端连接超时时间 proxy_pass tcp_proxy_443; } } 本文转自 小小三郎1 51CTO博客,原文链接:http://blog.51cto.com/wsxxsl/2044131,如需转载请自行联系原作者

优秀的个人博客,低调大师

ios7 设置status bar风格

How to change status bar style during launch on iOS 7 up vote 4 down vote favorite When I launch my app, it shows the launch image and a black status bar. How can I change it so the status bar is light during launch? I have set the status bar appearance to light in my AppDelegate didFinishLoading method, and it works for the rest of the app. ios objective-c ios7 share | edit | flag asked Sep 20 at 19:22 user1008096 23 2 add comment 1 Answer active oldest votes up vote 5 down vote To yourInfo.plistfile add this key-value pair: UIStatusBarStyle:UIStatusBarStyleLightContent The default (black) value isUIStatusBarStyleDefault. You can also append~iphoneor~ipadto the key. share | edit | flag answered Sep 20 at 19:28 iMartin 2,015 4 11 add comment 欢迎加群互相学习,共同进步。QQ群:iOS: 58099570 | Android: 572064792 | Nodejs:329118122 做人要厚道,转载请注明出处! 本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/sunshine-anycall/p/3341024.html ,如需转载请自行联系原作者

优秀的个人博客,低调大师

ES设置查询的相似度算法

similarity Elasticsearch allows you to configure a scoring algorithm orsimilarityper field. Thesimilaritysetting provides a simple way of choosing a similarity algorithm other than the defaultBM25, such asTF/IDF. Similarities are mostly useful fortextfields, but can also apply to other field types. Custom similarities can be configured by tuning the parameters of the built-in similarities. For more details about this expert options, see thesimilarity module. The only similarities which can be used out of the box, without any further configuration are: BM25 The Okapi BM25 algorithm. The algorithm used by default in Elasticsearch and Lucene. See Pluggable Similarity Algorithmsfor more information. classic The TF/IDF algorithm which used to be the default in Elasticsearch and Lucene. See Lucene’s Practical Scoring Functionfor more information. boolean A simple boolean similarity, which is used when full-text ranking is not needed and the score should only be based on whether the query terms match or not. Boolean similarity gives terms a score equal to their query boost. Thesimilaritycan be set on the field level when a field is first created, as follows: PUT my_index { "mappings": { "my_type": { "properties": { "default_field": { "type": "text" }, "classic_field": { "type": "text", "similarity": "classic" }, "boolean_sim_field": { "type": "text", "similarity": "boolean" } } } } } COPY AS CURL VIEW IN CONSOLE Thedefault_fielduses theBM25similarity. Theclassic_fielduses theclassicsimilarity (ie TF/IDF). Theboolean_sim_fielduses thebooleansimilarity. Default and Base Similarities By default, Elasticsearch will use whatever similarity is configured asdefault. However, the similarity functionsqueryNorm()andcoord()are not per-field. Consequently, for expert users wanting to change the implementation used for these two methods, while not changing thedefault, it is possible to configure a similarity with the namebase. This similarity will then be used for the two methods. You can change the default similarity for all fields in an index when it iscreated: PUT /my_index { "settings": { "index": { "similarity": { "default": { "type": "classic" } } } } } If you want to change the default similarity after creating the index you mustcloseyour index, send the follwing request andopenit again afterwards: PUT /my_index/_settings { "settings": { "index": { "similarity": { "default": { "type": "classic" } } } } } from:https://www.elastic.co/guide/en/elasticsearch/reference/5.4/index-modules-similarity.html 本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/bonelee/p/7451929.html,如需转载请自行联系原作者

优秀的个人博客,低调大师

elasticSearch空间坐标的设置和查询

原文网址:http://blog.csdn.net/yangwenbo214/article/details/54411004 一、数据准备 为了方便起见,我模拟臆造了json格式的数据 {"timestamp":"2017-01-13T13:13:32.2516955+08:00","deviceId":"myFirstDevice","windSpeed":17,"haze":284,"city":"Beijing","lat":33.9402,"lon":116.40739} 1 模拟数据我用的是c#,大概如下: static void SendingRandomMessages() { //var eventHubClient = EventHubClient.CreateFromConnectionString(connectionString, eventHubName); int len = 4; string[] citys = { "Beijing", "Shangjhai", "Guangzhou", "Shenzhen" }; int[] avgWindSpeed = { 10, 16, 5, 7 }; int[] avgWindSpeed1 = { 10, 16, 5, 7 }; int[] avgHaze1 = { 200, 100, 50, 49 }; int[] avgHaze = { 200, 100, 50, 49 }; double[] latitude = { 39.3402, 31.23042, 23.13369, 22.54310 }; double[] longitude = { 116.40739, 121.47370, 113.28880, 114.057860 }; Random rand = new Random(); while (true) { try { for (int i = 0; i < len; i++) { avgWindSpeed[i] = avgWindSpeed1[i] + rand.Next(1, 11); avgHaze[i] = avgHaze1[i] + rand.Next(10, 100); var telemetryDataPoint = new { timestamp = DateTime.Now, deviceId = "myFirstDevice", windSpeed = avgWindSpeed[i], haze = avgHaze[i], city = citys[i], lat = latitude[i], lon = longitude[i] }; var message = JsonConvert.SerializeObject(telemetryDataPoint); //eventHubClient.Send(new EventData(Encoding.UTF8.GetBytes(message))); Console.WriteLine("{0} > Get message: {1}", "eventHubName", message); } } catch (Exception exception) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("{0} > Exception: {1}", DateTime.Now, exception.Message); Console.ResetColor(); } Thread.Sleep(200); } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 此处我是作为消息发到一个eventhub中,你正确的做法可以将json写到文本文件中,再通过logstash读取即可 我的目的有两个: 获取数据中的lat、lon经纬度数据在kibana Map中进行绘图 获取数据中的timestamp作为我在kibana中的搜索时间,默认情况下是@timestamp 二、解决问题的整体思路 lat、lon本质上是float类型,此处需要设计一个mapping 日志内的时间,本质上应该是个字符串。我们得先卡出这个字段,然后用date match进行转换 三、解决实例 1. mapping的设计,我给出一个template { "template": "geo-*", "settings": { "index.refresh_interval": "5s" }, "mappings": { "_default_": { "_all": {"enabled": true, "omit_norms": true}, "dynamic_templates": [ { "message_field": { "match": "message", "match_mapping_type": "string", "mapping": { "type": "string", "index": "analyzed", "omit_norms": true } } }, { "string_fields": { "match": "*", "match_mapping_type": "string", "mapping": { "type": "string", "index": "analyzed", "omit_norms": true, "fields": { "raw": {"type": "string", "index": "not_analyzed", "ignore_above": 256} } } } } ], "properties": { "@version": { "type": "string", "index": "not_analyzed" }, "lonlat": { "type": "geo_point" } } } } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 大概解释如下: “template”: “geo-*”,所有geo开头的索引,都将会套用这个template配置 “lonlat”: { “type”: “geo_point” } 这个定义了lonlat为geo_point类型,为以后Map绘制奠定基础,这个是关键。 NOTE:这个lonlat名字不能取成特定的关键名字?,我取成location一直报错。 更加详细的介绍你可以查看官网文档 2. 给出logstash的配置文件 input { file { path => "/opt/logstash/1.log" start_position => "beginning" sincedb_path => "/dev/null" } } filter { json { source => "message" } mutate { add_field => [ "[lonlat]", "%{lon}" ] add_field => [ "[lonlat]", "%{lat}" ] } date{ match=>["timestamp","ISO8601"] timezone => "Asia/Shanghai" "target" => "logdate" } } output { stdout { codec => rubydebug } elasticsearch { hosts =>"wb-elk" index => "geo-%{+YYYY.MM.dd}" # template => "/opt/logstash/monster.json" # template_overwrite => true } } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 大概解释一下: json {source => “message”}这个能将json数据格式分解出一个个字段 mutate 这个是向geo_point中加入经纬度数据 date {match=>}这个是将匹配json数据分解出来的timestamp,并以时间格式赋值给logdate output中注释掉的是template文件。我采用的是直接put template的方式,因此注释掉了。两个方法都可行 补充:经纬度信息格式确定和重命名: mutate { convert => { "lon" => "float" } convert => { "lat" => "float" } } mutate { rename => { "lon" => "[lonlat][lon]" "lat" => "[lonlat][lat]" } } 3.运行过程

优秀的个人博客,低调大师

设置nginx+php上传大文件

1、要让php能上传大文件,一般修改配置文件php.ini就可以,如下配置: file_uploads = on ; //是否允许通过HTTP上传文件的开关,默认为ON upload_tmp_dir ; //文件上传到服务器临时摆放的目录 upload_max_filesize=2m; //允许上传文件大小的最大值 post_max_size = 8m ; //指通过表单POST给PHP的所能接收的最大值,包括表单里的所有值。 max_execution_time=600; //每个PHP页面运行的最大时间值(秒),默认30秒 max_input_time = 600; //每个PHP页面接收数据所需的最大时间,默认60秒 memory_limit = 8m ; //每个PHP页面所吃掉的最大内存,以前的机制一般默认8M,现在基本都是128m 2、php配置好后,nginx不做相应的配置依然不能上传大文件,会提示 413 Request Entity Too Large 需要打开nginx.conf,在http{}配置内增加如下参数: client_max_body_size 50m; //最大能上传50m大小的文件。

优秀的个人博客,低调大师

用OpenStack Heat模板设置私有IaaS

业务流程是Iaas云的重要组成部分,可以帮助管理员更容易的进行部署。 诸如OpenStack的Iaas云应该是动态的。如果管理员需要手动创建云结点、实例和网络,那就完全没有利用云计算的灵活性。 像大多数被认为是OpenStack云的基本功能,流程作为独立组件包含在OpenStack中,被称作为Heat。如果你选择了开源的 OpenStack云架构,预计大部分功能会以这种方式实现。Heat被设计为创造人类和机器可访问的服务,管理云中的基础设施与应用程序完整生命周期。 Heat通过模版实现业务流程引擎。 将物理数据中心转换为OpenStack云,需要物理到虚拟的迁移计划和工具。Heat在理论上是可以使用的,但不是以业务流程引擎为预期目的。Heat 模版最适合部署相似的服务器。他们允许IT实现从旧数据中心到软件定义数据中心的过渡迁移:这通常意味着全新的架构,可以享受云架构带来的灵活性。 OpenStack Heat模版实际上与AWS CloudFormation模版格式的完全兼容,OpenStack数据中心内的实例都经过特定的配置。只要AWS和OpenStack实例的功能兼容,混合公有-私有云迁移是可以实现的。但OpenStack也不是100%能够兼容AWS的。 Heat模版在一个文本文件中描述了需要的内容,方面人员进行读写(见下述范例)。选项包括不同类型的基础设施资源,如服务器、浮动IP地址、卷、用户等等。模版同样可以管理这些资源之间的关系,还可以通过自动化实现复杂配置。 Heat并不只是创建资源;它管理整个资源生命周期。要做到这点,必须紧密与DevOps自动化服务集成,如Puppet与Chef,实现管理不同软件组件的状态。 AsampleOpenStackHeattemplate. heat_template_version:2013-05-23 description:Simpletemplatetodeployasinglecomputeinstancewithparameters parameters: key_name: type:string label:KeyName description:Nameofkey-pairtobeusedforcomputeinstance image_id: type:string label:ImageID description:Imagetobeusedforcomputeinstance instance_type: type:string label:InstanceType description:Typeofinstance(flavor)tobeused resources: my_instance: type:OS::Nova::Server properties: key_name:{get_param:key_name} image:{get_param:image_id} flavor:{get_param:instance_type} 范例中部署了一个虚拟机实例。Heat模版由两部分组成。一部分定义了参数,包括key_name、image、和instance_type。第二部分定义了通过该模版管理的资源,本例中为my_instance。为了管理这个资源,需要在一开始定义三个被成为属性的参数。在这里get_param语句定义了所有需要的属性数值。 这个OpenStack Heat是可用的,但对于需要定义成百上千OpenStack实例的管理员来说,并不会太有效果。参数值要求一个接着一个,最后实现大规模部署,这也是云计算资源通常的目标,是一个缓慢的过程。为了使其更快,需要在模版中使用环境文件。这些文件里包括了所有可用参数的数值集。 OpenStack Heat友好度如何? 虽然Heat很容易通过自动化工具实现有效和简单管理,但却不是特别方便用户使用。管理员不喜欢手动处理含有大量需求配置为ASCII文件。他们还有许多不同的选择来让云业务流程管理更轻松。 云业务流程工具目的在于更轻松的管理大规模云。许多公司都试图填补国内云管理空白,包括Cloudyn、Dell和RightScale。 是否还能够从OpenStack社区获得更高的期望呢?可能不会。虽然不是很直观,Heat确实是提供了有效的模版工具来管理云部署。这是一个后端功能,任何用户都可以打造一个灵活的前端接口来管理它。 前端的一个问题在于要如何开发才能让云业务流程更容易:为了更高效,前端工具必须能够访问OpenStack Heat模版中的相同的参数和配置选项,意味着这些解决方案也不见得会简单多少。 本文作者:陈德文 来源:51CTO

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。