首页 文章 精选 留言 我的

精选列表

搜索[Ångström],共10029篇文章
优秀的个人博客,低调大师

JavaEE课程概述 && JavaEE基础班课程概述 && JavaEE就业班课程概述

JavaEE课程概述 阶段 知识点概述 能解决的问题 市场价值 Java基础阶段 计算机基础知识编程基础面向对象异常图形化界面常用类介绍集合IO多线程网络编程数据存储综合案例 学生具备javase本地应用开发能力能够在本机开发一些应用软件例如:压缩软件、下载软件、聊天软件、模拟DOS系统、综合信息管理软件 ¥5000 JavaWeb+SSH框架阶段 HTMLCSSJavaScriptJQueryBootStarp响应式页面MySQLJDBC服务器端技术:WEB通信、Tomcat服务器,Servlet、request、response、Cookie、session、jsp、EL、JSTL过滤器、监听器AJAX技术传智商城文件上传与下载Linux服务器部署Nginx+Tomcat搭建集群完成负载均衡部署到阿里云Struts2框架学习Hibernate框架学习Spring框架学习Maven 学生具备简单网站的开发能力,并结合阿里云,具备了真实环境的项目部署能力,已经能够在企业担任javaee工程师开发岗位 ¥8000 综合项目实战阶段一 OracleWebServiceJQueryEasyUISpringData互联网金融(P2P)、物流、医疗等项目实战 综合项目一,完整的贯穿了之前学习的内容,并且引入权限、报表、接口、支付、缓存、消息队列等诸多主流就业元素,凭借此项目学员可以斩获万元薪资岗位 ¥10000 综合项目实战阶段二 MyBatis框架SpringMVC框架SSM框架整合LuceneSolrRedisZookeeperB2C大型购物网站项目实战 综合项目二,在综合项目一基础上对集群、高并发、优化,进行了针对增强,这些主流的高级就业元素,可以让学员更轻松面对互联网开发岗位 ¥12000 云计算之大数据阶段 Hadoop入门HDFS分布式文件系统MapReduce分布式计算模型ZooKeeper分布式协调框架HAdoop集群管理YARN资源调度系统Sqoop数据迁移工具Hbase分布式数据库Hive数据仓库Storm实时计算论坛日志分析项目 综合项目三,在互联网数据爆炸时代,大数据分析计算势必成为主流,Hadoop、Storm这些主流大数据分析计算框架肯定可以帮助学员在云计算大数据方向占尽先机 ¥15000 为知笔记链接:JavaEE基础班课程概述 为知笔记链接:JavaEE就业班课程概述我的GitHub地址: https://github.com/heizemingjun 我的博客园地址: http://www.cnblogs.com/chenmingjun 我的蚂蚁笔记博客地址: http://blog.leanote.com/chenmingjun Copyright ©2018 黑泽明军 【转载文章务必保留出处和署名,谢谢!】

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

WebSphere MQ&&Active MQ

WebSphere MQ 1、中间件处于应用软件与系统软件之间,是一种以自己的复杂换取企业应用简单化的可复用的基础软件,它使用系统软件所提供的基础服务(功能),衔接网络上应用系统的各个部分或不同的应用,能够达到资源共享、功能共享的目的。 2、三种通信技术: RPC(remote process call):同步; CPI-C:同步; MQI(message queue interface):异步通信方式,通信的方式与传送协议无关。 3、中间件产品: 消息中间件:IBM WebSphere MQ 交易中间件:IBM CICS,Bea tuxedo 对象中间件:IBM componentbroker,ionaorbix,borland,visibroker 应用服务器:IBM WebSphere,Bea weblogic 安全中间件:entrust 应用集成服务器:lss flowwan,IBM flowman,vitria businessagiliti 4、WebSphere MQ由消息传输系统和应用程序接口组成,资源是消息和队列; 消息传输系统:用于确保队列之间的消息提供,包括网络中不同系统上的远程队列之间的消息提供,并保证网络故障或关闭后的恢复; 应用程序接口:应用程序和消息系统之间通过WebSphere MQ API实现(API在所有WebSphere MQ平台上是一致的,API只有14个调用2个动作(发送put和接收get)) 消息:Request Message,Reply Message,Report Message,Datagram Message 一个消息包含两个因素:消息描述和数据消息 消息描述:用于定义,如消息传输目标 数据消息:如应用程序数据或数据库查询 队列:一个安全的存储消息的地方,消息的存储一般是顺序的,队列是消息分阶段的传送和接收,因为消息存放在队列中,所以应用程序可以相互独立的运行,以不同的速度,在不同的时间,不同的地点; 注:程序之间的通信通过传递消息而非直接调用程序;WebSphere MQ最基本而最重要的技术——可靠消息传输,它具有特殊的技术防止消息重复传送,确保消息一次且仅一次传送(once-and-only-once) 5、重要特点: 统一接口:目标应用程序位置的透明性(target application location transparency); 处理不依赖时间的限制:异步处理 给分布式处理提供强健的中间件:保证数据一致性,信息的传输(once-and-only-once),并可在系统故障时,及时恢复,业务不受影响 小节: WebSphere MQ是基于消息队列Message Queue或消息传送MessagePassing的中间件,主要功能是在应用程序之间传送消息,这些消息可以在不同的网络协议,不同的计算机系统和不同的应用软件之间传送,使用它可简单方便的开发出可靠高效的分布式应用系统; WebSphere的技术可实施在广泛的IBM和非IBM平台上,提供了一个面向业务的信息技术架构(基于WebSphere MQ的应用程序可以更接近的模拟商业问题,更容易设计、开发和维护),使得基于它的应用无结构限制,应用程序之间可以是一对一、一对多、多对多的关系,应用程序之间信息传递可以是单向或双向,灵活的结构,支持平衡工作负荷、并发处理、多路广播及其它应用程序之间的关系,总之是应用程序充分接近业务需求,并且当应用需求改变时,WebSphere MQ的结构可以很容易的跟着改变。 Active MQ: 1、Active MQ是开源的JMS的实现,部分特点:多种语言和协议编写;完全支持JMS和J2EE各版本;支持Ajax(异步应用);调整的信息持久化等。 2、消息生产者――》消息队列――》消费者 JMS(java message service):MOM(messageoriented middleware面向消息的中间件),应用程序在异步情况下可靠的传输和接收消息 Message producer:消息生产者 JMS provider:消息提供者(中转站) JMS consumer:消费者(接收者) JMS消息传递模式: 点对点模式:p2p,每个消息只能被一个接收者接收;每条消息要么被接收者从队列中取走,要么被JMS Provider在超时情况下删除;消息产生的时候接收者不一定存在,接收者可以在消息产生的任何时候取走消息; 发布/订阅模式:发送者为发布者,接收者为订阅者,一个消息可以有很多接收者,订阅者只能接收它订阅的主题中的消息,订阅者在消息发送的时候必须是活动的,并随时准备接收消息,否则会错过该消息。 JMS消息的组成:消息头(header);属性(property);消息体(body):bytemessage,mapmessage,streammessage,textmessage,objectmessage. 3、安装(必须先安装JDK(JavaDevelopment kit)才能装Active MQ): #mkdir/usr/java #tarzxvf /usr/src/ jdk-8u51-linux-x64.tar.gz -C/usr/java/ #cd/usr/java/ #ln-s jdk1.8.0_51 /usr/java/jdk #ls-l(查看链接是否正确) #vim/etc/profile.d/java.sh JAVA_HOME=/usr/java/jdk Export JAVA_HOME Export PATH=$PATH:$JAVA_HOME/bin:$JAVA_HOME/jre/bin #source/etc/profile.d/java.sh #java-version #javac-version(有正确结果输出则环境配置正确) #tarzxvf /usr/src/ apache-activemq-5.12.0-bin.tar.gz -C/usr/java/ #cd/usr/java/ #ln-s apache-activemq-5.12.0 /usr/java/activemq #ll(查看软链接是否正确) #vim/usr/java/activemq/conf/activemq.xml(主配置文件,通过此文件可优化配置,如撤销存储策略,broker的memoryUsage阀值,配置监听IP<transportConnectors>段等) #/usr/java/activemq/bin/activemq start|stop #netstat lntup |egrep“61616|8161” #ps-ef | grepactivemq #pkilljava http://localhost:8161/admin(浏览器登陆,可用图形化管理,首次登陆用户名密码均为admin) 本文转自 chaijowin 51CTO博客,原文链接:http://blog.51cto.com/jowin/1688986,如需转载请自行联系原作者

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

Choosing Between ElasticSearch, MongoDB &amp;amp; Hadoop

An interesting trend has been developing in the IT landscape over the past few years. Many new technologies develop and immediately latch onto the “Big Data” buzzword. And as older technologies add “Big Data” features in an attempt to keep up with the Joneses, we areseeing a blurring of the boundaries between various technologies. Say you have search engines such as ElasticSearch or Solr storing JSON documents, MongoDB storing JSON documents, or a pile of JSON documents stored in HDFS on a Hadoop cluster. Interestingly enough, you can fulfill many of the same use cases with any of these three configurations. ElasticSearch as a NoSQL database? Superficially, that doesn’t sound right, but nonethelessit is a valid scenario. Likewise, MongoDB with support for MapReduce over sharded collections can accomplish many of the same things as Hadoop. And, of course, with the many tools that you can layer on top of a Hadoop base (Hive, HBase, Pig, and the like) you can query data from your Hadoop cluster in a multitude of ways. Given that, can we now say that Hadoop, MongoDB and ElasticSearch are all exactly equivalent? Of course not. Each tool still has a niche for which it is most ideally suited, but each has enough flexibility to fulfill multiple roles. The question now becomes “What is the ideal use for each of these technologies”, and that my friends is what we will explore now. ElasticSearch has begun to spread beyond its roots as a “pure” search engine and now adds some features for analytics and visualization - but at its core,remains primarily a full-text search engine for locating documents by keyword. ElasticSearch builds on top of Lucene and supports extremely fast lookup and a rich query syntax. If you have millions (or more) of text documents and you need to locate documents by keywords located in that text, ElasticSearch fits the bill perfectly. Yes, if your documents are JSON you can treat ElasticSearch as a sort of lightweight “NoSQL database”. But ElasticSearch is not quite a “database engine” and provides less support for complex calculations and aggregation as part of a query - although the “statistics” facet does provide some ability to retrieve calculated statistical information scoped to the given query. Facets in ElasticSearch are intended mainly to support a “faceted navigation” facility. If you are looking to return a (usually small) collection of documents in response to a keyword query, and want the ability to support faceted navigation around those documents, then ElasticSearch is probably your best, first choice. If you need to perform more complex calculations, run server-side scripts against your data, and easily run MapReduce jobs on your data, then MongoDB or Hadoop enter the picture. 假设你的目的是通过指定keyword查询取得一个文档集合(一般是较小的),而且具有支持对文档基于切面的导航,elasticsearch会非常合适,可是假设你希望支持很多其它复杂的计算,在server端你的数据上执行脚本,非常easy的在你的数据上执行mapreduce成寻。那么MongoDB和Hadoop就在被考虑的范围里边了。 MongoDB is a “NoSQL” database which is designed from the ground up to be highly scalable, with automatic sharding support and a number of additional performance optimizations. MongoDB is a document oriented database which stores document in a “JSON like” format (technically BSON) with some extensions beyond plain JSON - for example, a native date type. MongoDB provides a text index type for supporting full-text search against fields which contain text, so we can see that there is overlap between what you can do with ElasticSearch and MongoDB, in terms of basic keyword search against a collection of documents. Where MongoDB goes beyond ElasticSearch is its support for features like server-side scripts in Javascript, aggregation pipelines, MapReduce support and capped collections. With MongoDB, you can use aggregation pipelines to process documents in a collection, streaming them through a sequence of pipeline operators where each operator transforms the document. Pipeline operators can generate entirely new documents or remove documents from the final output. This is a very powerful facility for filtering, processing and transforming data as it is retrieved. MongoDB also supports running map/reduce jobs over the data in a collection, using custom Javascript functions for the map and reduce phases of the operation. This allows for ultimate flexibility in performing any type of calculation or transformation to the selected data. 与ES相比,MongoDB超过es的地方是支持server端的javascript和聚合管道 以及MapReduce的支持和capped collections Another extremely powerful feature in MongoDB is known as “capped collections”. With the capped collections facility, a user can define a maximum size for a collection - after which the collection can simply be written to blindly, and it will roll-over data as necessary to maintain the specified size limit. This feature is extremely useful for capture logs and other streaming data for analysis. 另外一个很NB的特征是capped collections;通过capped collections。用户能够定义为一个collection定义最大的size,用来插入数据(仅仅能插入更新 不能删除)。依照LRU挤出数据存放新插入的数据,这个特点很适合获取log数据和流数据的存储和分析 科普一下capped collections 特点: 1.仅仅能插入,更新,不能删除doc,能够使用drop()删除整个collection 2.LRU列表。相信大家对这个应该非常了解了,oracle里面非常多地方就是用的这个规则,假设指定的集合大小满了。那么会依照LRU挤出数据存放新插入的数据,这里记得更新是不能超出collection的大小的,不能挤出空间存放更新的数据,这个也合情合理。 3.插入的记录都是依照插入的顺序排列,普通的collection在_id上是肯定有索引的,可是这里是没有的 4.能够高速的查询和插入。假设写比读的比例大。建议不要建立索引。否则写会耗费非常多额外的资源。 As you can see, while ElasticSearch and MongoDB have some overlap in possible use cases, they are not the same tool. But what about Hadoop? Isn’t Hadoop “just MapReduce” which is supported by MongoDB anyway? Is there really a use case for Hadoop where MongoDB isjust as suitable. In a word, yes. Hadoop is the grand-father of MapReduce based cluster computing frameworks. Hadoop provides probably the overall most flexible and powerful environment for processing large amounts of data, and definitely fits niches for which you would not use ElasticSearch or MongoDB. To understand why this is true, look at how Hadoop abstracts storage - via HDFS - from the associated computational facility. With data stored in HDFS, any arbitrary job can be run against that data, using either Java code written to the core MapReduce API, or arbitrary code written in native languages using Hadoop Streaming. And starting with Hadoop2 and YARN, even the core programming model is abstracted so that you aren’t limited to MapReduce. With YARN you can, for example, implement MPI on top of Hadoop and write jobs in that style. Additionally, the Hadoop ecosystem provides a staggering array of tools that build on top of HDFS and core MapReduce to query, analyze and process data. Hive provides a “SQL like” language that allows Business Analysts to query data using a syntax they are already familiar with. HBase provides a column oriented database on top of Hadoop. Pig and Sizzle provide two more alternative programming models for querying Hadoop Data. With data stored in HDFS using Hadoop, you inherit the ability to simply plugin Apache Mahout to use advanced machine learning algorithms on your data. While using RHadoopis straightforward to use the R statistical language to perform advanced statistical analyses on Hadoop data. So while Hadoop and MongoDB also have some overlapping use cases, and share some useful functionality (seamless horizontal scalability, for example) it remains the case that each tool serves a specific purpose in enterprise computing. If you simply want to locate documents by keyword and perform simple analytics, then ElasticSearch mayfit the bill. If you need to query documents that can be modeled as JSON and perform moderately more sophisticated analysis, then MongoDB becomes a compelling choice. And if you have a huge quantity of data that needs a wide variety of different types of complex processing and analysis, then Hadoop provides the broadest range of tools and the most flexibility. As always, it is important to choose the right tool(s) for the job at hand. And in the “Big Data” space the sheer number of technologies and the blurry lines can make this difficult. As we can see, there are specific scenarios which best suit each of these technologies and, more importantly,the differences do matter. Though, the best news of all isyou are notlimited to using only one of these tools. Depending on the details of your use case, it may actually make sense to build a combination platform. For example, ElasticSearch and Hadoop are known to work well together, with ElasticSearch providing rapid keyword search, and Hadoop jobs powering the more complicated analytics. In the end, it takes ample research and careful analysis to make the best choices for your computing environment. Before selecting any technology or platform, take the time to evaluate it carefully, understand what scenarios it was designed to optimize for, and what tradeoffs and sacrifices it makes. Start with a small pilot project to “kick the tires” before converting your entire enterprise to a new platform, and slowly grow into the new stack. Follow these steps and you can successfully navigate the maze of “Big Data” technologies and reap the associated benefits.\ 本文转自:http://www.osintegrators.com/opensoftwareintegrators%7CChoosing-Between-ElasticSearch-MongoDB-%2526-Hadoop 本文转自mfrbuaa博客园博客,原文链接:http://www.cnblogs.com/mfrbuaa/p/5208702.html,如需转载请自行联系原作者

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

Android Step Counter &amp;amp; Detector Sensor

package zhangphil.sensor; import android.content.Context; import android.hardware.Sensor; import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.util.Log; public class MainActivity extends AppCompatActivity { private String TAG = "ZHANG PHIL"; private SensorManager mSensorManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); startSensor(); } /** * 启动传感器。 */ private void startSensor() { mSensorManager = (SensorManager) this.getSystemService(Context.SENSOR_SERVICE); Sensor mStepCounterSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_COUNTER); Sensor mStepDetectorSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_STEP_DETECTOR); if (mSensorManager == null || mStepCounterSensor == null || mStepDetectorSensor == null) { throw new UnsupportedOperationException("设备不支持"); } mSensorManager.registerListener(mSensorEventListener, mStepCounterSensor, SensorManager.SENSOR_DELAY_NORMAL); mSensorManager.registerListener(mSensorEventListener, mStepDetectorSensor, SensorManager.SENSOR_DELAY_NORMAL); } private SensorEventListener mSensorEventListener = new SensorEventListener() { private float step, stepDetector; @Override public void onSensorChanged(SensorEvent sensorEvent) { /** * 计步计数传感器传回的历史累积总步数 */ if (sensorEvent.sensor.getType() == Sensor.TYPE_STEP_COUNTER) { step = sensorEvent.values[0]; Log.d(TAG, "STEP_COUNTER:" + step); } /** * 计步检测传感器检测到的步行动作是否有效? */ if (sensorEvent.sensor.getType() == Sensor.TYPE_STEP_DETECTOR) { stepDetector = sensorEvent.values[0]; Log.d(TAG, "STEP_DETECTOR:" + stepDetector); if (stepDetector == 1.0) { Log.d(TAG, "一次有效的步行"); } } } @Override public void onAccuracyChanged(Sensor sensor, int i) { } }; @Override protected void onDestroy() { super.onDestroy(); mSensorManager.unregisterListener(mSensorEventListener); } }

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

Openstack API 类型 &amp;amp; REST 风格

目录 目录 Openstack 提供了三种操作方式 Web界面 CIL 指令行 RESTful API REST 风格 RESTFul风格的API设计 基于HTTP协议的RESTful API OpenStack中的RESTful API开发框架 Openstack 提供了三种操作方式 Web界面 也就是通过Dashboard(儀表板)来使用Openstack雲計算平台上的功能。通过Web界面使用 OpenStack Services 这种方式是通过 OpenStack Horizon Project 提供的。Horizon Project 是一个Django Web Application。Horizon Project 会通过API来和各个 OpenStack Services 进行交互,然后在 Web 界面上顯示這些 Services 的状态和交互結果。 CIL 指令行 通过以往的 keystone、nova、neutron 等指令,或者通过最新的 OpenStack 指令来操作各个 Services 的功能。社区目前希望使用統一的 OpenStack 指令來代替以往每个 Project 都有各自的 Commands 的方式,这些 Commands 是由命名为 client(EG. keystoneclient、novaclient) 的項目所實現的。這些 client 項目除了爲用户提供命令行操作界面方式之外還提供了 Python 的 SDK (其实是在SDK的基础上实现了命令行)。这些 client 项目提供的 SDK 本質是封装了這些 Openstack services 的 API 的调用。現在 Openstack 社區希望僅使用 openstackclient 作爲统一的命令行工具,然后使用各个 Services 的 client 项目所提供的 SDK 来完成相应的操作。 RESTful API 通过各个 OpenStack Project 提供的 API 来使用各 Services 的功能。API 这种方式是支撐上述兩種方式的基础,由各个 Services 自身來实现使用 API 操作 OpenStack 的方式。这些 API 具有统一的形式,均采用了基於 HTTP 协议的 Restful 风格来实现。Openstack API 服务进程在接收了客户端的HTTP Request之后,一个所谓的 路由 模块就会将URL转换成为相应的资源,并路由到合适的操作函数上去。以此来实现了从API到具体操作的映射。 REST 风格 REST(Representational State Transfer)表述性状态转换,是一种软件架构的设计风格,而不是一种标准,为软件设计提供了一组原则和约束条件,但这是原则和约束的条件也同样不具有标准性。所以也可以将REST理解为是一组没有严格标准的架构约束条件和设计原则。REST的软件设计倾向于简单轻量的方法设计和实现,以及**REST具有通过HTTP直接传输数据的特性。**REST风格的软件架构必须满足下面两点规范: URI 标识资源:首先从Restful的角度来看,互联网上的任何东西(文本/图片/视频/歌曲/Services)都是一个资源。每个资源都使用了一个特定的URI来唯一标示,访问这一个URI就是访问这一个资源,而且这个资源具有至少一种状态。 无状态原则: 再一个就是,Client 和 Server 之间互相传递的只是资源的表述,即:调用资源的URI并获取资源的不同表现形式。并且 Client 和 Server 之间的交互是由 HTTP 无状态协议来支撑的,所以资源的所有状态都只会保存在 Server 中。当 Client 应用 HTTP 协议中的 GET/POST/PUT/DELETE 操作资源时,会使得 Server 中的资源的状态发生转换,这就是所谓的“表述性状态转换”。 RESTFul风格的API设计 你的URI中应该都是名词,表示一个事物,而非动词。EG. /resources/142 是好的URI,它看起来像是一个事物 而 /resources/142/get 则不是好的URI,因为它看起来更像是一个动作,只有事物才符合资源的定义。 面向资源的体系结构 URI使用名词,不使用动词 资源地址即URI 无状态性 灵活使用单数和复数 传输资源的表现形式(Web Server 接收和返回的互联网媒体类型,JSON/XML) 对资源的操作与HTTP内置方法映射 基于HTTP协议的RESTful API 由于这种软件设计风格非常适合采用HTTP协议来实现,因此HTTP协议是目前实现RESTful API的主要方案。 OpenStack 就是基于 HTTP 协议和 JSON 来实现自己的 RESTful API(之前OpenStack还有采用XML来表示数据的,现在都已经转到JSON了)。当一个 Service 要对外提供 API 时,它就会启动一个 HTTP Web Server,用来对外提供 RESTful API。 OpenStack 的 API 都是有详细的文档记录的,可以查看所有的API文档。 OpenStack 的 API 服务都是使用 WSGI 的方式来部署的。部署WSGI,一般会使用 Web Server + Application Server + Application(框架) 的部署方式。OpenStack 官方推荐的是使用 Apache + mod_wsgi ,当然你也可以选 nginx + uWSGI 。还有些项目会提供使用 eventlet 的单进程部署方案(EG. Keystone项目的keystone-all命令)。 OpenStack中的RESTful API开发框架 OpenStack 早期的核心项目(EG. Keystone/Nova/Glance/Neutron)使用了由几个模块组合出来的一个框架: Paste + PasteDeploy + Routes + WebOb 。这些模块分别负责了应用的 WSGI 化、URL 路由和请求处理等功能。但是这种框架存在着较为复杂的弊端,所以现在 Openstack 社区的新项目已经开始使用新的 Web 框架 Pecan。 Pecan 是一个基于对象路由的框架,即灵活又简单。Pecan 主要实现了 URL 路由功能,支持 RESTful API 。Pecan 没有实现模板、session 管理、 ORM 等功能,但是这些功能可以通过其他的模块来实现。对于 OpenStack 来说,Pecan 是一个很好的选择,因为 OpenStack 项目中统一使用 sqlalchemy 来实现ORM,API的实现也不需要模板功能,安全控制则基于 Keystone 体系。使用 Pecan 来开发 REST 服务,代码量很少,代码结构也清晰。

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

hadoop(2): 安装&amp;amp;使用 sqoop

本文的原文连接是: http://blog.csdn.net/freewebsys/article/details/47722393 未经博主允许不得转载。 1,关于sqoop Sqoop是一个用来将Hadoop和关系型数据库中的数据相互转移的工具,可以将一个关系型数据库(例如 : MySQL ,Oracle ,Postgres等)中的数据导入到Hadoop的HDFS中,也可以将HDFS的数据导入到关系型数据库中。 官网:http://sqoop.apache.org/ 一个1.4.6 版本,一个是1.99版本(开发版还没有迁移完成,生产环境不推荐) 文档: http://sqoop.apache.org/docs/1.4.6/ 2,安装 参考之前的文章hadoop和hive用的是2.0,所以sqoop这里也用2.0,不过是alpha。直接解压缩。 配置环境变量 export JAVA_HOME=/usr/java/default export CLASS_PATH=$JAVA_HOME/lib export PATH=$JAVA_HOME/bin:$PATH export HADOOP_HOME=/data/hadoop export PATH=$HADOOP_HOME/bin:$PATH export HIVE_HOME=/data/apache-hive export PATH=$HIVE_HOME/bin:$PATH export SQOOP_HOME=/data/sqoop export PATH=$SQOOP_HOME/bin:$PATH sqoop启动的时候会检查hbase环境变量,不需要,直接注释 /data/sqoop/bin/configure-sqoop 的128 行到 147行。 128 ## Moved to be a runtime check in sqoop. 129 #if [ ! -d "${HBASE_HOME}" ]; then 130 # echo "Warning: $HBASE_HOME does not exist! HBase imports will fail." 131 # echo 'Please set $HBASE_HOME to the root of your HBase installation.' 132 #fi 133 134 ## Moved to be a runtime check in sqoop. 135 #if [ ! -d "${HCAT_HOME}" ]; then 136 # echo "Warning: $HCAT_HOME does not exist! HCatalog jobs will fail." 137 # echo 'Please set $HCAT_HOME to the root of your HCatalog installation.' 138 #fi 139 140 #if [ ! -d "${ACCUMULO_HOME}" ]; then 141 # echo "Warning: $ACCUMULO_HOME does not exist! Accumulo imports will fail." 142 # echo 'Please set $ACCUMULO_HOME to the root of your Accumulo installation.' 143 #fi 144 #if [ ! -d "${ZOOKEEPER_HOME}" ]; then 145 # echo "Warning: $ZOOKEEPER_HOME does not exist! Accumulo imports will fail." 146 # echo 'Please set $ZOOKEEPER_HOME to the root of your Zookeeper installation.' 147 #fi hadoop和hive参考之前写的博客: http://blog.csdn.net/freewebsys/article/details/47617975 sqoop命令主要就分为数据导入到hadoop,和数据从hadoop导出到 mysql。 首先创建mysql数据库blog,创建一个hadoop用户操作blog库,blog库里面创建一个msg表,插入6条记录 CREATE DATABASE blog DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; GRANT ALL PRIVILEGES ON blog.* TO sqoop@"%" IDENTIFIED BY "sqoop"; FLUSH PRIVILEGES; ##创建msg和 msg_hive数据表: CREATE TABLE `msg_hive` ( `id` bigint(20) NOT NULL, `gid` bigint(20) DEFAULT NULL , `content` varchar(4000), `create_time` datetime DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`,`gid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PARTITION BY KEY(`gid`); CREATE TABLE `msg` ( `id` bigint(20) NOT NULL, `gid` bigint(20) DEFAULT NULL , `content` varchar(4000), `create_time` datetime DEFAULT NULL COMMENT '创建时间', PRIMARY KEY (`id`,`gid`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 PARTITION BY KEY(`gid`); #插入测试数据。 insert into `msg`(id,gid,content,create_time) values(1,1,'zhang san 11',now()); insert into `msg`(id,gid,content,create_time) values(1,2,'zhang san 22',now()); insert into `msg`(id,gid,content,create_time) values(1,3,'zhang san 33',now()); insert into `msg`(id,gid,content,create_time) values(2,1,'li si 11',now()); insert into `msg`(id,gid,content,create_time) values(2,2,'li si 22',now()); insert into `msg`(id,gid,content,create_time) values(2,3,'li si 33',now()); 3,sqoop使用,导入,导出 首先测试下数据库连接执行select。 sqoop eval --connect jdbc:mysql://127.0.0.1:3306/blog --username sqoop --password sqoop --query 'select now()' ##执行结果: ----------------------- | now() | ----------------------- | 2015-08-18 17:22:26.0 | ----------------------- 将mysql 数据导入到hive中,其实就是导入到hadoop上面,这里需要指定输出目录是hive的warehouse目录: sqoop import --direct --connect jdbc:mysql://127.0.0.1:3306/blog --username sqoop --password sqoop --table msg \ --fields-terminated-by "\001" --lines-terminated-by "\n" --delete-target-dir --null-string '\\N' --null-non-string '\\N' --target-dir /user/hive/warehouse/msg 参数一大堆,设置分隔符的,设置null的。最后指定hive的warehouse目录。 但是这样hive还不识别这个表,必须在hive中创建下。 sqoop create-hive-table --hive-table msg --connect jdbc:mysql://127.0.0.1:3306/blog --username sqoop --password sqoop --table msg 将hive 数据导入到 mysql中。 sqoop export --direct --connect jdbc:mysql://127.0.0.1:3306/blog --username sqoop --password sqoop --table msg_hive \ --fields-terminated-by "\001" --lines-terminated-by "\n" --export-dir /user/hive/warehouse/msg 同样的需要配置export-dir,配置mysql的数据表msg_hive 检查结果:(分别在hive和mysql中查看数据) hive> select * from msg; OK 1 1 zhang san 11 2015-08-17 12:11:32 1 2 zhang san 22 2015-08-17 12:11:33 1 3 zhang san 33 2015-08-17 12:11:33 2 1 li si 11 2015-08-17 12:11:33 2 2 li si 22 2015-08-17 12:11:33 2 3 li si 33 2015-08-17 12:11:33 Time taken: 0.105 seconds, Fetched: 6 row(s) mysql> select * from msg_hive; +----+-----+--------------+---------------------+ | id | gid | content | create_time | +----+-----+--------------+---------------------+ | 2 | 1 | li si 11 | 2015-08-17 12:11:33 | | 2 | 2 | li si 22 | 2015-08-17 12:11:33 | | 2 | 3 | li si 33 | 2015-08-17 12:11:33 | | 1 | 3 | zhang san 33 | 2015-08-17 12:11:33 | | 1 | 1 | zhang san 11 | 2015-08-17 12:11:32 | | 1 | 2 | zhang san 22 | 2015-08-17 12:11:33 | +----+-----+--------------+---------------------+ 6 rows in set (0.00 sec) 4,总结 本文的原文连接是: http://blog.csdn.net/freewebsys/article/details/47722393 未经博主允许不得转载。 sqoop提供了import和export功能,很方便的就可以迁移mysql和hive的数据。 业务数据需要迁移到hadoop上面进行计算,同时,将计算结果放到mysql数据库中进行统计显示。 数据可以方便的流动。 参考: http://segmentfault.com/a/1190000002532293 写的参数很详细。

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

让 ESS 更灵活的新特性:UserData &amp; KeyPair &amp; RamRole &amp; Tags

弹性伸缩(Elastic Scaling Service, ESS)是一种根据业务需求和策略,自动调整其弹性计算资源的管理服务,在满足业务需求高峰增长时无缝地增加 ECS 实例,并在业务需求下降时自动减少 ECS 实例以节约成本。 为了提供更加弹性、灵活的伸缩服务,ESS 弹性伸缩配置中新增了 UserData、KeyPair、RamRole、Tags 四个特性。使用 UserData,您可以快速安全的完成自动化的配置过程,在 ECS 实例数量随着业务需求弹性变化的同时,您还能够安全、快速地完成应用级别的扩容和缩容。您还可以通过配置 KeyPair、Tags 等参数,实现更加高效、智能的 ECS 实例管理服务。 本文将详细介绍 ESS 新增的四个特性,并结合具体场景,向您阐述这些特性在 ESS 中的使用方式。您可以根据自己的业务场景,

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

容器服务&amp;&amp;AHAS Sentinel 弹性 Demo

应用高可用服务 AHAS(Application High Availability Service)是一款阿里云应用高可用服务相关产品。只要容器服务中的 Java 应用接入了 AHAS 应用流控组件后,用户的应用实例就可以自动根据 AHAS Sentinel 收集的指标(如 QPS、平均响应时间等)进行弹性伸缩,使得系统可以自动根据实时的流量情况进行扩缩容,保证系统的可用性。 0. 安装 alibaba-cloud-metrics-adapter 可以直接在容器服务控制台 应用目录 中安装 alibaba-cloud-metrics-adapter。 相关 repo:https://github.com/AliyunContainerService/alibaba-cloud-metrics-adapter 1. 安装 AHAS Sen

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

Docker 上传镜像&amp;amp;拉取镜像

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_36367789/article/details/81623850 与git相似,docker也有自己的镜像仓库,官方仓库网站是https://hub.docker.com/,其实我们平时docker pull xxx就是从该仓库得到的镜像(在不设置国内镜像加速的情况下)。它和git仓库很相似。 创建账号 DockerHub:https://hub.docker.com/ 很多人在这里就出了问题,为什么都填完了但是不能点注册按钮呢?因为该网站目前来说注册是需要翻墙的,注册成功后再关闭翻墙。 我重新上传一个项目做示范,该镜像是从hub上pull到的一个nginx镜像,我把它上传到我的公开仓库。 上传镜像 先登录docker hub账号。 docker login [root@FantJ ~]# docker login Login with your Docker ID to push and pull images from Docker Hub. If you don't have a Docker ID, head over to https://hub.docker.com to create one. Username (fantj): fantj Password: Login Succeeded [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]# docker tag docker.io/nginx fantj/nginx [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB fantj/nginx latest ae513a47849c 4 weeks ago 109 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]# docker push fantj/nginx The push refers to a repository [docker.io/fantj/nginx] 7ab428981537: Mounted from library/nginx 82b81d779f83: Mounted from library/nginx d626a8ad97a1: Mounted from library/nginx latest: digest: sha256:e4f0474a75c510f40b37b6b7dc2516241ffa8bde5a442bde3d372c9519c84d90 size: 948 [root@FantJ ~]# 流程大概是:登录->tag操作->push 注:tag 的第二个参数的前缀是你的hub账户名 拉取镜像 我先把服务器上的镜像删除掉,然后再从hub中拉取镜像。 # 删除本地fantj/nginx镜像 [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB fantj/nginx latest ae513a47849c 4 weeks ago 109 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]# docker rmi fantj/nginx Untagged: fantj/nginx:latest Untagged: fantj/nginx@sha256:e4f0474a75c510f40b37b6b7dc2516241ffa8bde5a442bde3d372c9519c84d90 [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB # 从hub中拉取fantj/nginx镜像 [root@FantJ ~]# docker pull fantj/nginx Using default tag: latest Trying to pull repository docker.io/fantj/nginx ... latest: Pulling from docker.io/fantj/nginx Digest: sha256:e4f0474a75c510f40b37b6b7dc2516241ffa8bde5a442bde3d372c9519c84d90 Status: Downloaded newer image for docker.io/fantj/nginx:latest [root@FantJ ~]# docker images REPOSITORY TAG IMAGE ID CREATED SIZE docker.io/openjdk 8-jre bef23b4b9cac 2 weeks ago 443 MB docker.io/fantj/nginx latest ae513a47849c 4 weeks ago 109 MB docker.io/nginx latest ae513a47849c 4 weeks ago 109 MB [root@FantJ ~]#

资源下载

更多资源
优质分享App

优质分享App

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

Mario

Mario

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

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

Sublime Text

Sublime Text

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

用户登录
用户注册
修改密码
忘记密码