'2020/05'에 해당되는 글 13건

  1. 2020.05.27 [RaspberryPI] 설정 따라하기...
  2. 2020.05.27 [SSH] port 22: Connection refused
  3. 2020.05.27 [Elasticsearch]7.x breaking changes.
  4. 2020.05.25 [Filebeat] setup.ilm & setup.template 잘 쓰려면.
  5. 2020.05.25 [Javascript] JQuery @(at) 처리 문제.
  6. 2020.05.21 [Ace] ace editor json beautify 하기
  7. 2020.05.20 [Spring] Spring Security Disabled.
  8. 2020.05.18 [Git] Master 브랜치로 돌리기.
  9. 2020.05.11 [Beats] Filebeat 내 JSON 처리.
  10. 2020.05.11 [Kibana] Docker Compose 실행 시 Permission 오류.

[RaspberryPI] 설정 따라하기...

ITWeb/개발일반 2020. 5. 27. 14:53

Raspberry PI 설정

 $ gpio readall
 +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |
 |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5v      |     |     |
 |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |
 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | IN   | TxD     | 15  | 14  |
 |     |     |      0v |      |   |  9 || 10 | 1 | IN   | RxD     | 16  | 15  |
 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | OUT  | GPIO. 1 | 1   | 18  |
 |  27 |   2 | GPIO. 2 |  OUT | 0 | 13 || 14 |   |      | 0v      |     |     |
 |  22 |   3 | GPIO. 3 |  OUT | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |
 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |
 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |
 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |
 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |
 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |
 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |
 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |
 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |
 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |
 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |
 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |
 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |
 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+
 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
 +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+

 

[build.gradle]

// pi4j
compile group: 'com.pi4j', name: 'pi4j-core', version: '1.2'
compile group: 'com.pi4j', name: 'pi4j-device', version: '1.2'
compile group: 'com.pi4j', name: 'pi4j-gpio-extension', version: '1.2'
compile group: 'com.pi4j', name: 'pi4j-service', version: '1.1'
compile group: 'com.pi4j', name: 'pi4j-native', version: '1.2', ext: 'pom'
compile group: 'com.pi4j', name: 'pi4j-parent', version: '1.2', ext: 'pom'
compile group: 'com.pi4j', name: 'pi4j-distribution', version: '1.2'
compile group: 'com.pi4j', name: 'pi4j-example', version: '1.2'

 

[참고문서]

https://wiki.keyestudio.com/KS0221_keyestudio_Ultimate_Starter_Kit_for_Raspberry_Pi

https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/

https://pi4j.com/1.2/pins/model-3b-plus-rev1.html

https://mvnrepository.com/artifact/com.pi4j

https://github.com/Pi4J

 

Trackbacks 0 : Comments 0

Write a comment


[SSH] port 22: Connection refused

ITWeb/개발일반 2020. 5. 27. 14:32

$ sudo vi /etc/ssh/sshd_config

Port 22

 

$ sudo /etc/init.d/ssh restart

[ ok ] Restarting ssh (via systemctl): ssh.service.

 

Trackbacks 0 : Comments 0

Write a comment


[Elasticsearch]7.x breaking changes.

Elastic/Elasticsearch 2020. 5. 27. 14:05

다 알아야 하겠지만 이 정도는 알고 넘어 가면 좋을 것 같아 뽑아 봤습니다.

 

참고문서)

https://www.elastic.co/guide/en/elasticsearch/reference/7.7/breaking-changes-7.0.html

 

thread_pool.listener.size and thread_pool.listener.queue_size have been deprecated
cluster.remote.connect is deprecated in favor of node.remote_cluster_client
auth.password deprecated, auth.secure_password setting instead.
Deprecation of sparse vector fields
The vector functions of the form function(query, doc['field']) are deprecated, and the form function(query, 'field') should be used instead. 
The nGram and edgeNGram tokenizer names haven been deprecated with 7.6. 
	-> The tokenizer name should be changed to the fully equivalent ngram or edge_ngram names for new indices and in index templates.
Starting in version 7.4, a + in a URL will be encoded as %2B by all REST API functionality.
	-> es.rest.url_plus_as_space to true
After starting each shard the elected master node must perform a reroute to search for other shards that could be allocated. (>7.4)
Auto-release of read-only-allow-delete block
	-> es.disk.auto_release_flood_stage_block: true
pidfile setting is being replaced by node.pidfile
processors setting is being replaced by node.processors
The common query has been deprecated.
	-> match query
Only a single port may be given for each seed host.
	-> "10.11.12.13:9300-9310" then Elasticsearch would only use 10.11.12.13:9300 for discovery.
The http.tcp_no_delay setting is deprecated in 7.1. It is replaced by http.tcp.no_delay.
The network.tcp.connect_timeout setting is deprecated in 7.1
	-> transport.connect_timeout.
transport.tcp.port is replaced by transport.port
transport.tcp.compress is replaced by transport.compress
transport.tcp.connect_timeout is replaced by transport.connect_timeout
transport.tcp_no_delay is replaced by transport.tcp.no_delay
transport.profiles.profile_name.tcp_no_delay is replaced by transport.profiles.profile_name.tcp.no_delay
transport.profiles.profile_name.tcp_keep_alive is replaced by transport.profiles.profile_name.tcp.keep_alive
transport.profiles.profile_name.reuse_address is replaced by transport.profiles.profile_name.tcp.reuse_address
transport.profiles.profile_name.send_buffer_size is replaced by transport.profiles.profile_name.tcp.send_buffer_size
transport.profiles.profile_name.receive_buffer_size is replaced by transport.profiles.profile_name.tcp.receive_buffer_size
delimited_payload_filter renaming
	-> delimited_payload
The standard token filter has been removed
The standard_html_strip analyzer has been deprecated,
	-> combination of the standard tokenizer and html_strip char_filter
Shard preferences _primary, _primary_first, _replica, and _replica_first are removed
indices.breaker.fielddata.limit has been lowered from 60% to 40% of the JVM heap size.
The index_options field for numeric fields has been deprecated in 6 and has now been removed.
The classic similarity has been removed.
Adaptive replica selection has been enabled by default.
Semantics changed for max_concurrent_shard_requests
	->  In 7.0 this changed to be the max number of concurrent shard requests per node. The default is now 5
Negative boosts are not allowed
The filter context has been removed from Elasticsearch’s query builders, the distinction between queries and filters is now decided in Lucene depending on whether queries need to access score or not.
Tribe node functionality has been removed in favor of Cross Cluster Search.
Camel case and underscore parameters deprecated in 6.x have been removed
The default for node.name is now the hostname
The setting node.store.allow_mmapfs has been renamed to node.store.allow_mmap.
The setting http.enabled previously allowed disabling binding to HTTP, only allowing use of the transport client. This setting has been removed, as the transport client will be removed in the future, thus requiring HTTP to always be enabled.
Trackbacks 0 : Comments 0

Write a comment


[Filebeat] setup.ilm & setup.template 잘 쓰려면.

Elastic/Beats 2020. 5. 25. 17:09

가끔 설정은 yml 에 잘 했는데 안될 때가 있습니다.

이게 어디에서 뭘로 했느냐에 따라 다른데요.

 

보통 beats 를 이용할 경우 자동으로 alias 생성 및 설정이 됩니다.

이 경우 elasticsearch 에서 동일하게 사용 하기 위한 ilm 과 template 설정을 하게 되면 동작이 잘 안되는 경우가 있는데요.

 

큰 차이는 is_write_index 설정 때문 입니다.

뭐 이것도 경우에 따라 다르게 나올 수 있지만 일반적이라면 저 설정 때문이다 생각 하시면 됩니다.

 

beats 에서는 libbeat 에서 자동으로 설정을 해줍니다.

 

// CreateAlias sends request to Elasticsearch for creating alias.
func (h *ESClientHandler) CreateAlias(alias Alias) error {
	// Escaping because of date pattern
	// This always assume it's a date pattern by sourrounding it by <...>
	firstIndex := fmt.Sprintf("<%s-%s>", alias.Name, alias.Pattern)
	firstIndex = url.PathEscape(firstIndex)

	body := common.MapStr{
		"aliases": common.MapStr{
			alias.Name: common.MapStr{
				"is_write_index": true,
			},
		},
	}

	// Note: actual aliases are accessible via the index
	status, res, err := h.client.Request("PUT", "/"+firstIndex, "", nil, body)
	if status == 400 {
		// HasAlias fails if there is an index with the same name, that is
		// what we want to check here.
		_, err := h.HasAlias(alias.Name)
		if err != nil {
			return err
		}
		return errOf(ErrAliasAlreadyExists)
	} else if err != nil {
		return wrapErrf(err, ErrAliasCreateFailed, "failed to create alias: %s", res)
	}

	return nil
}

하지만, elasticsearch 에서 수동으로 설정을 한다고 하면 꼭 "is_write_index:true" 설정을 해주셔야 alias 생성 및 등록이 잘 된다는거 알고 넘어 가자고요.

 

Trackbacks 0 : Comments 0

Write a comment


[Javascript] JQuery @(at) 처리 문제.

ITWeb/개발일반 2020. 5. 25. 12:19

$('#@id').removeClass('new').addClass('old');

 

여기서 @ 때문에 jquery 내부에서 오류가 발생을 합니다.

이럴 경우 DOM 을 직접 컨트롤 해주셔서 해결 하시면 됩니다.

 

var policyId = 'result' + policyName;

var el = document.getElementById(policyId);

 

el.classList.remove('new');

el.classList.add('old');

tags : ADD, Class, jquery, remove
Trackbacks 0 : Comments 0

Write a comment


[Ace] ace editor json beautify 하기

ITWeb/개발일반 2020. 5. 21. 10:23

참고문서)

https://ace.c9.io/#nav=howto

 

필요한 JS 파일) 필요한 resource 모두 받아 두었습니다.

<script src="/statics/js/ace/ace.js"></script>
<script src="/statics/js/ace/ext-beautify.js"></script>

 

Editor DIV)

<div id="shadowStateEditor" style="width:100%; height:300px;">
{
  "state": {
    "reported": {
      "welcome": "Ace World"
    }
  }
}
</div>

 

Javascript) 설정 및 적용

// res.data 는 ajax 처리 후 success 에서 넘겨 받은 json 데이터 입니다.

ace.edit("shadowStateEditor").setValue(
  JSON.stringify(
    JSON.parse(res.data), null, 2
  )
);

drawShadowStateEditor();

function drawShadowStateEditor(){
  var beautify = ace.require("ace/ext/beautify");
  var editor = ace.edit("shadowStateEditor");

  editor.setTheme("ace/theme/nord_dark");
  editor.session.setMode("ace/mode/json");
  editor.setShowInvisibles(false);
  editor.setReadOnly(true);
  editor.setShowPrintMargin(false);
  editor.session.setTabSize(2);
  editor.session.setUseSoftTabs(true);
  editor.session.setUseWrapMode(true);

  beautify.beautify(editor.session);

  editor.resize();
}

 

tags : Ace, beautify, Editor, JSON
Trackbacks 0 : Comments 0

Write a comment


[Spring] Spring Security Disabled.

ITWeb/개발일반 2020. 5. 20. 15:10

spring security 를 사용하면서 테스트를 위해 인증을 off 하고 싶을 때 사용 하면 됩니다.

 

Application main)
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)

application.yml)
security:
  enable:
    csrf: false
  basic:
    enabled: false
  ignored: /**
management:
  security:
    enabled: false

위에서 처럼 두 군데에 적용해 주면 됩니다.

Trackbacks 0 : Comments 0

Write a comment


[Git] Master 브랜치로 돌리기.

ITWeb/개발일반 2020. 5. 18. 15:00

[로컬 Master 브랜치를 Remote Master 로 돌리기]

 

$ git fetch origin

$ git reset --hard origin/master

$ git clean -f -d

 

가끔 개발 브랜치 인줄 알고 merge 했는데, 헐... master 브랜치...

그럼 돌리세요. :)

tags : FORCE, GIT, master, Sync
Trackbacks 0 : Comments 0

Write a comment


[Beats] Filebeat 내 JSON 처리.

Elastic/Beats 2020. 5. 11. 14:18

1. input type log 에서 처리 하는 방법과

2. processor 에서 decode_json_fields 로 처리 하는 방법이 있습니다.

 

1번은 그냥 전체 로그에 대해서 처리

2번은 특정 필드의 메시지에 대해서 처리

 

자세한건 문서를 참고해 주세요.

 

[Reference]

https://www.elastic.co/guide/en/beats/filebeat/7.6/filebeat-input-log.html

https://www.elastic.co/guide/en/beats/filebeat/7.6/decode-json-fields.html

 

Trackbacks 0 : Comments 0

Write a comment


[Kibana] Docker Compose 실행 시 Permission 오류.

Elastic/Kibana 2020. 5. 11. 14:15

kibana 를 docker-compose 를 이용해서 실행 할 때 설정 파일, kibana.yml 파일에 대한 permission 오류가 발생 할 때가 있습니다.

이 경우 처음 부터 kibana.yml 파일이 있는 위치에 permission 을 부여 해 주거나 docker-compose.yml 파일에서 아래와 같이 추가 하시면 문제를 해결 할 수 있습니다.

 

user: "1002:0"

 

- host 서버에서

$ id

uid=1002 gid=20

 

- container 에서 

$ id

uid=1000 gid=0

 

실행한 놈과 실행 된 놈의 user 가 달라서 발생 하는 오류 입니다.

권한을 주거나 user 를 맞춰 주시면 됩니다.

tags : docker, kibana
Trackbacks 0 : Comments 0

Write a comment