不积跬步,无以至千里


  • 首页

  • 标签

  • 分类

  • 归档

  • 搜索

Flume简介与实践

发表于 2014-11-05 | 分类于 大数据 | | 阅读次数:

Flume是一个分布式、高可用日志收集系统,可以收集不同来源的日志并集中存储。目前Flume是Apache顶级项目。

架构

数据流模型

UserGuide_image00
Flume Agent是一个JVM进程,包含三个基本组件:

  1. Source,用于从外部数据源获取数据;
  2. Channel,用于暂存数据;
  3. Sink,用于向目标发送数据。
阅读全文 »

Elasticsearch简介与实践

发表于 2014-10-16 | 分类于 后端 | | 阅读次数:

Elasticsearch是一个基于Lucene的开源搜索引擎,使用Elasticsearch可以搭建分布式、可扩展、高可用的搜索集群,并提供RESTful API。Elasticsearch包含的数据结构及其与关系数据库的类比如下所示:

Elasticsearch 关系数据库
index database
mapping table
document row
field field

工作中,我们使用Elasticsearch搭建搜索集群,对文章构建索引并提供文章搜索接口。使用了Elasticsearch中文发行版elasticsearch-rtf,该版本针对中文集成了相关插件。从Github上下载压缩包https://github.com/medcl/elasticsearch-rtf/archive/1.0.0.tar.gz 并解压。

阅读全文 »

Odd Even Linked List

发表于 2014-05-13 | 分类于 数据结构与算法 | | 阅读次数:

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the value in the nodes.

You should try to do it in place. The program should run in O(1) space complexity and O(nodes) time complexity.

Example:
Given 1->2->3->4->5->NULL,
return 1->3->5->2->4->NULL.

Note:
The relative order inside both the even and odd groups should remain as it was in the input.
The first node is considered odd, the second node even and so on …

阅读全文 »

聚簇索引(摘自《高性能MySQL》)

发表于 2014-04-01 | 分类于 关系数据库 | | 阅读次数:

InnoDB的聚簇索引实际上在同一个结构中保存了B-Tree索引和数据行。
当表有聚簇索引时,它的数据行实际上存放在索引的叶子页(leaf page)中。术语“聚簇”表示数据行和相邻的键值紧凑地存储在一起。因为无法同时把数据行存放在两个不同的地方,所以一个表只能有一个聚簇索引。

阅读全文 »

解决NoClassDefFoundError: Could not initialize class net.sf.json.JsonConfig

发表于 2014-04-01 | 分类于 后端 | | 阅读次数:

今天在开发时遇到了如下错误:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class net.sf.json.JsonConfig

NoClassDefFoundError不同于ClassNotFoundException,而且在pom.xml里面已经加上了net.sf.json.JsonConfig的jar包依赖,所以不是缺少该类,而是在类加载时发生了错误,进一步看JsonConfig的源码,发现import了以下两个类:

阅读全文 »

Remove Duplicates from Sorted Array

发表于 2014-03-13 | 分类于 数据结构与算法 | | 阅读次数:

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

Do not allocate extra space for another array, you must do this in place with constant memory.

For example,
Given input array nums = [1,1,2],

Your function should return length = 2, with the first two elements of nums being 1 and 2 respectively. It doesn’t matter what you leave beyond the new length.

阅读全文 »

Thrift简介与实践

发表于 2014-03-11 | 分类于 后端 | | 阅读次数:

Thrift是一个支持多种语言的远程服务调用框架,最初由Facebook开发,目前由Apache基金会负责维护。

安装

tar -zxvf thrift-0.9.1.tar.gz
cd thrift-0.9.1/
./configure
make
make install

安装成功后,可以使用“thrift”命令。

阅读全文 »

使用iptables限制redis端口的访问

发表于 2014-02-14 | 分类于 服务器 | | 阅读次数:

redis默认端口是6379,使用iptables限制该端口访问。

设置规则链

  1. 新建规则链:

    iptables -N RH-Firewall-1-INPUT

  2. 在规则链中添加可以访问6379端口的规则,表示ip XXX.XXX.XXX.XXX可以访问redis端口,可以多次添加,为不同的ip设置访问权限:

    iptables -A RH-Firewall-1-INPUT -p tcp –dport 6379 -s XXX.XXX.XXX.XXX -j ACCEPT

  3. 在规则链中添加禁止访问6379端口的规则,表示任意ip都禁止访问redis端口:

    iptables -A RH-Firewall-1-INPUT -p tcp –dport 6379 -s 0.0.0.0/0 -j DROP

阅读全文 »

ProcessBuilder中“Too many open files”错误的解决

发表于 2014-01-10 | 分类于 后端 | | 阅读次数:

在一个系统中程序每隔5分钟会通过ProcessBuilder创建进程执行shell脚本。系统运行一段时间后,会报以下错误:

java.io.IOException: Cannot run program “ssh”: java.io.IOException: error=24, Too many open files at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)

阅读全文 »

TinyMCE高级编辑器中的一个乱码问题

发表于 2013-12-24 | 分类于 前端 | | 阅读次数:

系统使用了TinyMCE,最近修改了前端的一个功能,即在提交前,取出TinyMCE编辑器中的内容,使用Ajax方式传入后台,修改内容,再传回前台填入TincyMCE编辑器中。测试时发现内容传回前台后,会经常在有些地方多个“?”号,感觉是内容在传入后台、传回前台时发生了乱码问题,但排查了一下,系统的编码并没有问题,后来再排查并通过从网上查找资料,找到了原因。

阅读全文 »

1…345…9
magicwt

magicwt

89 日志
9 分类
49 标签
GitHub E-Mail
© 2018 magicwt
由 Hexo 强力驱动
|
主题 — NexT.Mist v5.1.4