Database Class Loader started - derby.database.classpath=''

18/11/29 22:05:54 ERROR PoolWatchThread: Error in trying to obtain a connection. Retrying in 7000ms

java.sql.SQLException: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.

at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)

at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown Source)

at org.apache.derby.impl.jdbc.EmbedConnection.setReadOnly(Unknown Source)

at com.jolbox.bonecp.ConnectionHandle.setReadOnly(ConnectionHandle.java:1324)

at com.jolbox.bonecp.ConnectionHandle.<init>(ConnectionHandle.java:262)

at com.jolbox.bonecp.PoolWatchThread.fillConnections(PoolWatchThread.java:115)

at com.jolbox.bonecp.PoolWatchThread.run(PoolWatchThread.java:82)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

Caused by: ERROR 25505: A read-only user or a user in a read-only database is not permitted to disable read-only mode on a connection.

at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)

at org.apache.derby.iapi.error.StandardException.newException(Unknown Source)

at org.apache.derby.impl.sql.conn.GenericAuthorizer.setReadOnlyConnection(Unknown Source)

at org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.setReadOnly(Unknown Source)




원인은 권한이다. spark-shell의 권한이 root 또는  metastore_db 디렉토리의 권한을 확인한다.

Posted by '김용환'
,



kubernetes에서 cronjob 실행하기 


$ vi cronjob.yaml

apiVersion: batch/v1beta1

kind: CronJob

metadata:

  name: sleepy

spec:

  schedule: "*/1 * * * *"

  jobTemplate:

    spec:

      template:

        spec:

          containers:

          - name: resting

            image: busybox

            command: ["/bin/sleep"]

            args: ["3"]

          restartPolicy: Never





$ kubectl create -f cronjob.yaml

cronjob.batch/sleepy created





시간에 따라 확인한다.



$ kubectl get cronjobs.batch

NAME      SCHEDULE      SUSPEND   ACTIVE    LAST SCHEDULE   AGE

sleepy    */1 * * * *   False     0         <none>          40s



$ kubectl get cronjobs.batch

NAME      SCHEDULE      SUSPEND   ACTIVE    LAST SCHEDULE   AGE

sleepy    */1 * * * *   False     0         1m              2m




Posted by '김용환'
,


kubernetes에서 proxy 사용 예시이다



$ kubectl proxy --api-prefix=/ &

[1] 9789

Starting to serve on 127.0.0.1:8001





$ curl http://127.0.0.1:8001/api/

{

  "kind": "APIVersions",

  "versions": [

    "v1"

  ],

  "serverAddressByClientCIDRs": [

    {

      "clientCIDR": "0.0.0.0/0",

      "serverAddress": "10.1.1.1:6443"

    }

  ]






$ curl http://127.0.0.1:8001/api/v1/namespaces
{
"kind": "NamespaceList",
"apiVersion": "v1",
"metadata": {
"selfLink": "/api/v1/namespaces",
"resourceVersion": "445783"
"items": [
    {
      "metadata": {
        "name": "default",
        "selfLink": "/api/v1/namespaces/default",
        "uid": "8fd4381e-f15f-11e8-8c69-fa163ec1822d",
        "resourceVersion": "5",
        "creationTimestamp": ",.,,,17Z"
      },
      "spec": {
        "finalizers": [
          "kubernetes"
        ]
      },
      "status": {
        "phase": "Active"
      }
    },
    {
      "metadata": {
        "name": "ingres

...

Posted by '김용환'
,



다음은 kubernetes의 discovery 예시이다.




$ kubectl config view

apiVersion: v1

clusters:

- cluster:

certificate-authority-data: REDACTED

server: https://10.1.1.1:6443

name: kubernetes

...




$ kubectl get secrets

NAME                  TYPE                                  DATA      AGE

default-token-686zl   kubernetes.io/service-account-token   3         3d





$ kubectl describe secret default-token-686zl

Name:         default-token-686zl

Namespace:    default

Labels:       <none>

Annotations:  kubernetes.io/service-account.name=default

              kubernetes.io/service-account.uid=a0b98cf2-f15f-11e8-9449-fa163e9f27a5


Type:  kubernetes.io/service-account-token


Data

====

ca.crt:     1090 bytes

namespace:  7 bytes

token:      xxxx



$ export token=$(kubectl describe secret default-token-686zl |grep ^token |cut -f7 -d ' ')



$ echo $token

xxx



$ curl https://10.1.1.1:6443/apis --header "Authorization: Bearer $token" -k

{

"kind": "APIVersions",

"versions": [

"v1"

],

"serverAddressByClientCIDRs": [

{

"clientCIDR": "0.0.0.0/0",

"serverAddress": "10.1.1.1:6443"

}

]

}

...



이전 결과와 동일하다. 



$ curl https://10.128.0.3:6443/api/v1 --header "Authorization: Bearer $token" -k


{

"kind": "APIVersions",

"versions": [

"v1"

],

"serverAddressByClientCIDRs": [

{

"clientCIDR": "0.0.0.0/0",

"serverAddress": "10.1.1.1:6443"

}

]

}

...




Posted by '김용환'
,