4월, 2020의 게시물 표시

[Elastic] APM Agent 설치

[설치] [APM Agent 다운로드] https://search.maven.org/search?q=g:co.elastic.apm%20AND%20a:elastic-apm-agent [Tomcat 설정] export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/elastic-apm-agent-<version>.jar" (다운로드받은 Agent 경로 및 파일명) export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.service_name=my-cool-service” (서비스 이름 아무거나 지정해 주세요.) export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.application_packages=org.example,org.another.example” (도메인명 아무거나 지정해 주세요.) export CATALINA_OPTS="$CATALINA_OPTS -Delastic.apm.server_urls= http://1.234.25.136:40002 ” (APM 서버 ip 및 포트 이럴로 해주세요.) [Java 프로그램 설정] java  -javaagent:/path/to/elastic-apm-agent-<version>.jar (다운로드받은 Agent 경로 및 파일명) -Delastic.apm.service_name=my-cool-service -Delastic.apm.application_packages=org.example,org.another.example -Delastic.apm.server_urls=http://1.234.25.136:40002  -jar my-application.jar ( 실행할 프로그램 )

[Elastic] Filebeat 설치

[설치] curl -L -O https://artifacts.elastic.co/downloads/beats/filebeat/filebeat-7.6.2-linux-x86_64.tar.gz tar xzvf filebeat-7.6.2-linux-x86_64.tar.gz [설정] filebeat.inputs: - type: log   enabled: true   paths:     - /var/log/*.log output.elasticsearch:   hosts: ["myEShost:9200"]   username: "filebeat_internal"   password: "YOUR_PASSWORD"  setup.kibana:   host: "mykibanahost:5601"   username: "my_kibana_user"     password: "YOUR_PASSWORD"

[Elastic] Install elasticsearch cluster

[elasticsearch install - linux Version] wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.6.2-linux-x86_64.tar.gz.sha512 shasum -a 512 -c elasticsearch-7.6.2-linux-x86_64.tar.gz.sha512  tar -xzf elasticsearch-7.6.2-linux-x86_64.tar.gz cd elasticsearch-7.6.2/ node별로 설치한다. [elasticsearch configuration for a cluster] Node별로 $ES_HOME/config/elasticsearch.yml을 아래와 같이 설정한다. [node1] cluster.name: elastic-poc node.name: elastic-node1 path.data: /home/pocuser/elastic-node1/elasticsearch/data path.logs: /home/pocuser/elastic-node1/elasticsearch/logs network.host: 1.234.25.136 http.port: 49100 transport.port: 49110 discovery.seed_hosts: ["1.234.25.136: 49110 ", "1.234.25.136: 49210 ", "1.234.25.136: 49310 "] cluster.initial_master_nodes: ["elastic-node1", "elastic-node2", "elastic-node3&q

[Ubuntu] 환경변수 설정, 확인, 삭제, 버전확인

환경변수 설정 export AAA=bbb 환경변수 확인 env | grep AAA 환경변수 삭제 unset AAA 버전확인 cat /etc/issue

[Elastic] kibana reporting error

[에러메시지] log   [08:12:47.276] [error][reporting] The Reporting plugin encountered issues launching Chromium in a self-test. You may have trouble generating reports.  error  [08:12:47.276] [error][reporting] Error: Failed to launch chrome! /home/ubuntu/elastic/kibana-7.6.2-linux-x86_64/data/headless_shell-linux/headless_shell: error while loading shared libraries: libnss3.so : cannot open shared object file: No such file or directory TROUBLESHOOTING: https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md     at onClose (/home/ubuntu/elastic/kibana-7.6.2-linux-x86_64/node_modules/puppeteer-core/lib/Launcher.js:349:14)     at Interface.helper.addEventListener (/home/ubuntu/elastic/kibana-7.6.2-linux-x86_64/node_modules/puppeteer-core/lib/Launcher.js:338:50)     at Interface.emit (events.js:203:15)     at Interface.close (readline.js:397:8)     at Socket.onend (readline.js:173:10)     at Socket.emit (events.js:203:15)     at endReadableN

[Ubuntu] shell .profile

우분투에서는 홈 디렉토리에 .bash_profile 대신 .profile을 사용한다. export LS_HOME=/home/ubuntu/elastic export PATH=$PATH:. (현재 디렉토리 포함)

[Elastic] elasticsearch start and stop

[Start] 일반실행 elasticsearch 데몬실행 elasticsearch -d -p $ES_HOME/pid 데몬중지 pkill -F $ES_HOME/pid

[정규표현식]

이메일  /^[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*@[0-9a-zA-Z]([-_\.]?[0-9a-zA-Z])*\.[a-zA-Z]{2,3}$/i '시작을'  0~9 사이 숫자 or a-z A-Z 알바펫 아무거나로 시작하고  /  중간에 - _  . 같은 문자가 있을수도 있고 없을수도 있으며 /  그 후에 0~9 사이 숫자 or a-z A-Z 알바펫중 하나의 문자가 없거나 연달아 나올수 있으며 /  @ 가 반드시 존재하고  /  0-9a-zA-Z 여기서 하나가 있고  /  중간에 - _  . 같은 문자가 있을수도 있고 없을수도 있으며 / 그 후에 0~9 사이 숫자 or a-z A-Z 알바펫중 하나의  문자가 없거나 연달아 나올수 있으며 /  반드시  .  이 존재하고  / [a-zA-Z] 의 문자가 2개나 3개가 존재 /   이 모든것은 대소문자 구분안함  전화번호 /^\d{3}-\d{3,4}-\d{4}$/ 시작을 숫자 3개로하며 /   중간에 하이픈 -  하나 존재 /  숫자가 3~4개 존재하며 /  하이픈 하나 존재 /  숫자 4개로 끝남  핸드폰 번호 /^01([0|1|6|7|8|9]?)-?([0-9]{3,4})-?([0-9]{4})$/ 시작을 숫자 01로 시작하며 그 후에 0,1,6,7,8,9 중에 하나가 나올수도 있으며 /  하이픈 - 하나 존재할수도 있으며 /  숫자 3~4개 이어지고 /  또 하이픈 - 하나 존재할수도 있으며 /  숫자 4개가 이어짐  URL ^(https?):\/\/([^:\/\s]+)(:([^\/]*))?((\/[^\s/\/]+)*)?\/?([^#\s\?]*)(\?([^#\s]*))?(#(\w*))?$ ^(https?):\/\/ ([^:\/\s]+) (:([^\/]*))? ((\/[^\s/\/]+)*)?\/?([^#\s\?]*)(\?([^#\s]*))?(#(\w*))?$

[Django API] homepage - index.html

{% extends 'homepage/base.html' %} {% block content %} {% load static %} {% load thumbnail %} <!-- start banner Area --> <section class="banner-area relative" id="home" style="background: url({% static 'homepage/img/main2.jpg' %}) center no-repeat; background-size:cover;">     <div class="overlay overlay-bg"></div>       <div class="container">         <div class="row fullscreen d-flex align-items-center justify-content-between">             <div class="banner-content col-lg-9 col-md-12">                 <h1>                     이제 정시예측은<br>                     인공지능에게...                            </h1>                 <br><br>                 <a href="http://aipass.prefity.com/webapp/" class="genric-btn primary-border circle" id="android_btn" style="font-s

[Django API] homepage - urls.py

from django.urls import path from django.views.decorators.csrf import csrf_exempt from . import views urlpatterns = [     path('', views.IndexView.as_view(), name='index'), ]

[Django API] homepage - views.py

from django.shortcuts import render, redirect, get_object_or_404 from django.urls import reverse_lazy from django.views import View from django.views.generic.base import TemplateView from django.views.generic import DetailView, ListView from django.views.decorators.csrf import csrf_exempt from django.http import HttpResponse, JsonResponse from django.utils import timezone from django.contrib.auth import login as d_login, logout as d_logout, authenticate import logging logger = logging.getLogger(__name__) class IndexView(TemplateView):     template_name = 'homepage/index.html'     def get_context_data(self, **kwargs):         context = super().get_context_data(**kwargs)         return context

[Django API] homepage - admin.py

from django.contrib import admin from . import models # Register your models inline here. class CodeInline(admin.TabularInline):     model = models.Code     fields = ('name', 'title', 'pid', 'display_order', 'status') class ContentInline(admin.TabularInline):     model = models.Content     fields = ('name', 'title', 'pid', 'display_order', 'status') # # Register your model admin here. class CodeAdmin(admin.ModelAdmin):     list_display = ('id', 'pid', 'name', 'title', 'display_order', 'status')     list_filter = ['status', 'pid']     list_display_links = ['name']     inlines = [         CodeInline,     ] class ContentAdmin(admin.ModelAdmin):     list_display = ('id', 'pid', 'name', 'title', 'status')     list_filter = ['status', 'type&

[Django API] homepage - models.py

from django.db import models from ckeditor.fields import RichTextField from ckeditor_uploader.fields import RichTextUploadingField from filer.fields.image import FilerImageField from filer.fields.file import FilerFileField from django.shortcuts import get_object_or_404 from django.utils import timezone from django.contrib.auth.models import User from crum import get_current_user from datetime import date import logging logger = logging.getLogger('aipass') # Internal Code STATUS = (     (1, 'Active'),     (2, 'Inactive'), ) # Web  class Code(models.Model):     pid                 = models.ForeignKey('self', on_delete=models.PROTECT, related_name='homepage_code_pid', blank=True, null=True)     name                = models.CharField(max_length=200)     title               = models.CharField(max_length=500, blank=True, null=True)     description         = models.TextField(blank=True, null=Tru

[Django API] homepage - html template

{% extends 'homepage/base.html' %} {% block content %} {% load static %} {% load thumbnail %} HTML 작성 {% endblock %}

[Django API] homepage - base.html

{% load static %} {% load sass_tags %}      <!DOCTYPE html> <html lang="zxx" class="no-js"> <head>     <!-- Mobile Specific Meta -->     <!-- <meta name="viewport" content="width=1024"> -->     <meta name="viewport" id="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">     <!-- Never 사이트 검증 코드 -->     <!-- <meta name="naver-site-verification" content="1e1c586d8eadb2b411f83f5ce181a5e8b07aff96"/> -->     <!-- 대표 URL -->     <link rel="canonical" href="http://aipass.prefity.com">     <!-- Favicon-->     <link rel="shortcut icon" href="{% static 'homepage/img/fav.png' %}">     <!-- Author Meta -->     <meta name="author" content="aipass">     <!-- Meta Description -->